flutter_genius_scan 3.0.24

Flutter Android iOS

Flutter plugin for the Genius Scan SDK for iOS and Android. It allows scanning paper documents using a smartphone camera.

example/lib/main.dart

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

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

import 'package:open_file/open_file.dart';

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('GS SDK Flutter Demo'),
          ),
          body: MyScaffoldBody()),
    );
  }
}

class MyScaffoldBody extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: RaisedButton(
      onPressed: () {
        FlutterGeniusScan.scanWithConfiguration({
          'source': 'camera',
          'multiPage': true,
        }).then((result) {
          String pdfUrl = result['pdfUrl'];
          OpenFile.open(pdfUrl.replaceAll("file://", '')).then(
              (result) => debugPrint(result),
              onError: (error) => displayError(context, error));
        }, onError: (error) => displayError(context, error));
      },
      child: Text("START SCANNING"),
    ));
  }

  void displayError(BuildContext context, PlatformException error) {
    Scaffold.of(context).showSnackBar(SnackBar(content: Text(error.message)));
  }
}
20
likes
100
pub points
78%
popularity

Publisher

thegrizzlylabs.com

Flutter plugin for the Genius Scan SDK for iOS and Android. It allows scanning paper documents using a smartphone camera.

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_genius_scan