scan_preview 0.0.1 copy "scan_preview: ^0.0.1" to clipboard
scan_preview: ^0.0.1 copied to clipboard

outdated

A flutter plugin for scan barcode.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:scan_preview/scan_preview.dart';
import 'package:scan_preview/scan_preview_widget.dart';

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    _requestPermission();
  }

  _requestPermission() async {
    await Permission.camera.request();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Scan barcode example'),
        ),
        body: Container(
          child: ScanPreviewWidget(
            onScanResult: (result) {
              setState(() {
                debugPrint('scan result: $result');
              });
            },
          ),
        ),
      ),
    );
  }
}
7
likes
30
pub points
43%
popularity

Publisher

unverified uploader

A flutter plugin for scan barcode.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on scan_preview