qrcode_barcode_scanner 1.0.0 qrcode_barcode_scanner: ^1.0.0 copied to clipboard
Plugins to manage the reading of QR code or barcode from an external device as a keyboard.
import 'package:flutter/material.dart';
import 'package:qrcode_barcode_scanner/qrcode_barcode_scanner.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String? _scanValue;
@override
void initState() {
super.initState();
QrcodeBarcodeScanner(
onScannedCallback: (String value) => setState(
() {
_scanValue = value;
},
),
);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Scan value: ${_scanValue ?? "none"}'),
),
),
);
}
}