recognition_qrcode 1.0.1 recognition_qrcode: ^1.0.1 copied to clipboard
The flutter plugin that identifies the QR code in the imagenflu.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:image_picker/image_picker.dart';
import 'package:recognition_qrcode/recognition_qrcode.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: CupertinoButton(
child: Text("识别图片"),
onPressed: () {
final picker = ImagePicker();
picker.getImage(source: ImageSource.gallery).then((value) {
RecognitionQrcode.recognition(value.path).then((result) {
print("RecognitionQrcode: $result");
});
}); //
}),
),
),
);
}
}