Version updated and dartdocs added

This commit is contained in:
Julian Finkler 2020-02-19 23:36:18 +01:00
parent 14a744d0af
commit d96581e552
2 changed files with 13 additions and 1 deletions

View File

@ -2,10 +2,22 @@ import 'dart:async';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
/// Barcode scanner plugin
/// Simply call `var barcode = await BarcodeScanner.scan()` to scan a barcode
class BarcodeScanner { class BarcodeScanner {
/// If the user has not granted the access to the camera this code is thrown.
static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED'; static const CameraAccessDenied = 'PERMISSION_NOT_GRANTED';
/// If the user cancel the scan an exception with this code is thrown.
static const UserCanceled = 'USER_CANCELED'; static const UserCanceled = 'USER_CANCELED';
/// The method channel
static const MethodChannel _channel = static const MethodChannel _channel =
const MethodChannel('de.mintware.barcode_scan'); 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<String> scan() async => await _channel.invokeMethod('scan'); static Future<String> scan() async => await _channel.invokeMethod('scan');
} }

View File

@ -1,6 +1,6 @@
name: barcode_scan name: barcode_scan
description: A flutter plugin for scanning 2D barcodes and QRCodes via camera. 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 homepage: https://github.com/mintware-de/flutter_barcode_reader
dependencies: dependencies: