mvbarcodescan 0.0.8 copy "mvbarcodescan: ^0.0.8" to clipboard
mvbarcodescan: ^0.0.8 copied to clipboard

A new Flutter plugin to scan barcode and qrcodes using Google Mobile vision & Apple AVFoundation

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:mvbarcodescan/mvbarcodescan.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String? _scannedBarCode = '';

  @override
  void initState() {
    super.initState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> scanBarCode() async {
    String? barCode;
    try {
      barCode = await Mvbarcodescan.scan;
    } on PlatformException {
      barCode = '';
    }

    setState(() {
      _scannedBarCode = barCode!;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            scanBarCode();
          },
          child: Icon(Icons.camera),
        ),
        appBar: AppBar(
          title: const Text('Barcode Scan'),
        ),
        body: Center(
          child: Text('Scanned Barcode : ' + _scannedBarCode!),
        ),
      ),
    );
  }
}
2
likes
120
pub points
52%
popularity

Publisher

verified publisherandroid-pratap.blogspot.com

A new Flutter plugin to scan barcode and qrcodes using Google Mobile vision & Apple AVFoundation

Homepage

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on mvbarcodescan