From d96581e552bc066ea2d88983696519c6b1acacab Mon Sep 17 00:00:00 2001 From: Julian Finkler Date: Wed, 19 Feb 2020 23:36:18 +0100 Subject: [PATCH] Version updated and dartdocs added --- lib/barcode_scan.dart | 12 ++++++++++++ pubspec.yaml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/barcode_scan.dart b/lib/barcode_scan.dart index ed99626..8000445 100644 --- a/lib/barcode_scan.dart +++ b/lib/barcode_scan.dart @@ -2,10 +2,22 @@ import 'dart:async'; import 'package:flutter/services.dart'; +/// Barcode scanner plugin +/// Simply call `var barcode = await BarcodeScanner.scan()` to scan a barcode class BarcodeScanner { + /// If the user has not granted the access to the camera this code is thrown. static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED'; + + /// If the user cancel the scan an exception with this code is thrown. static const UserCanceled = 'USER_CANCELED'; + + /// The method channel static const MethodChannel _channel = const MethodChannel('de.mintware.barcode_scan'); + + /// Starts the camera for scanning the barcode, shows a preview window and + /// returns the barcode if one was scanned. + /// Can throw an exception. + /// See also [CameraAccessDenied] and [UserCanceled] static Future scan() async => await _channel.invokeMethod('scan'); } diff --git a/pubspec.yaml b/pubspec.yaml index ada5d41..c3cdf7f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: barcode_scan description: A flutter plugin for scanning 2D barcodes and QRCodes via camera. -version: 1.0.0 +version: 2.0.0 homepage: https://github.com/mintware-de/flutter_barcode_reader dependencies: