document_scanner_kit 0.1.0+1 copy "document_scanner_kit: ^0.1.0+1" to clipboard
document_scanner_kit: ^0.1.0+1 copied to clipboard

Flutter Document Scanner Plugin that uses MLKit for android and VisionKit for iOS

example/lib/main.dart

import 'dart:io';

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(home: HomePage());
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  List<String>? _scannedImages;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('DocumentScannerKit Example')),
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            mainAxisSize: MainAxisSize.min,
            children: [
              if (_scannedImages == null)
                const SizedBox.shrink()
              else
                Column(
                  children: [
                    for (final path in _scannedImages!) Image.file(File(path)),
                  ],
                ),
              const SizedBox(height: 16),
              ElevatedButton(
                  onPressed: () async {
                    if (!context.mounted) return;
                    try {
                      final result = await scan();
                      setState(() => _scannedImages = result);
                    } catch (error) {
                      if (!context.mounted) return;
                      ScaffoldMessenger.of(context).showSnackBar(
                        SnackBar(
                          backgroundColor: Theme.of(context).primaryColor,
                          content: Text('$error'),
                        ),
                      );
                    }
                  },
                  child: const Text('Scan Document')),
            ],
          ),
        ),
      ),
    );
  }
}
3
likes
160
points
0
downloads

Publisher

verified publisherahmetsbulbul.com

Weekly Downloads

Flutter Document Scanner Plugin that uses MLKit for android and VisionKit for iOS

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

document_scanner_kit_android, document_scanner_kit_ios, document_scanner_kit_platform_interface, flutter

More

Packages that depend on document_scanner_kit