{"id":19273037,"url":"https://github.com/fluttercandies/scan_barcode","last_synced_at":"2025-04-21T22:32:20.072Z","repository":{"id":149155139,"uuid":"595485473","full_name":"fluttercandies/scan_barcode","owner":"fluttercandies","description":"Barcode/QRCode scan, base of google mikit.","archived":false,"fork":false,"pushed_at":"2025-03-15T14:12:40.000Z","size":430,"stargazers_count":16,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-01T16:14:40.049Z","etag":null,"topics":["dart","flutter","flutter-plugin","qrcode"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fluttercandies.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-31T07:09:26.000Z","updated_at":"2025-03-15T12:00:09.000Z","dependencies_parsed_at":"2024-06-24T11:43:57.644Z","dependency_job_id":"f50789f9-b05f-4be5-a8f5-c1184acfb5a2","html_url":"https://github.com/fluttercandies/scan_barcode","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fscan_barcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fscan_barcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fscan_barcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fluttercandies%2Fscan_barcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fluttercandies","download_url":"https://codeload.github.com/fluttercandies/scan_barcode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250144386,"owners_count":21382215,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","flutter","flutter-plugin","qrcode"],"created_at":"2024-11-09T20:40:23.137Z","updated_at":"2025-04-21T22:32:15.060Z","avatar_url":"https://github.com/fluttercandies.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scan_barcode\n\nThe plugin is a plugin for scanning barcodes. Only support android and ios. Because the plugin is based on Google mlkit.\n\n\u003cimg src=\"https://github.com/FlutterCandies/scan_barcode/blob/main/screenshot/s1.jpg?raw=true\" width=\"300\" /\u003e\n\nSee apk in [release](https://github.com/fluttercandies/scan_barcode/releases)\n\n## Getting Started\n\n```yaml\ndependencies:\n  scan_barcode: ^0.2.0\n```\n\n```yaml\nscan_barcode:\n  git:\n    url: https://github.com/FlutterCandies/scan_barcode.git\n    ref: git-ref\n```\n\n```yaml\nscan_barcode:\n  git:\n    url: https://gitee.com/kikt/scan_barcode.git\n    ref: git-ref\n```\n\nSee the package [scan_barcode](https://pub.dev/packages/scan_barcode) for more version.\n\n`import 'package:scan_barcode/scan_barcode.dart';`\n\nThe plugin is developed by version 3.7.0 of flutter, so it is recommended to use version 3.1.0 or above.\nIf you want to use the package of Flutter 2.x, click [here](#using-in-flutter-2x).\n\n## Contents\n\nThe package has the following important classes:\n\n- [BarcodeWidget](#barcodewidget)\n- [BarcodeConfig](#barcodeconfig)\n\n### BarcodeWidget\n\nIn most cases, we will use this component to complete code scanning.\n\n### BarcodeConfig\n\nThis class is used to configure the scanning config. And, hold instance to update config.\n\nThe config has the following parts:\n\n- CameraConfig: The camera config.\n- BarcodeConfig: The barcode config.\n- UIConfig: The UI config.\n\n## Example\n\nSee the [example](./example/lib/examples) for more examples.\n\n### One shot scan code\n\nIf you want to scan a code once, you can use the example.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eClick to expand code\u003c/summary\u003e\n\n```dart\nFuture\u003cvoid\u003e _scanBarcode() async {\n  final barcodes = await Navigator.push\u003cList\u003cBarcode\u003e\u003e(\n    context,\n    MaterialPageRoute(\n      builder: (context) =\u003e const ScanAndPopPageExample(),\n    ),\n  );\n  if (barcodes == null) return;\n  showBarcodeListDialog(context, barcodes); // show barcode list dialog to display barcode.\n}\n```\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:scan_barcode/scan_barcode.dart';\n\nclass ScanAndPopPageExample extends StatefulWidget {\n  const ScanAndPopPageExample({Key? key}) : super(key: key);\n\n  @override\n  State\u003cScanAndPopPageExample\u003e createState() =\u003e _ScanAndPopPageExampleState();\n}\n\nclass _ScanAndPopPageExampleState extends State\u003cScanAndPopPageExample\u003e {\n  var isPop = false;\n\n  @override\n  Widget build(BuildContext context) {\n    return BarcodeWidget(\n      onHandleBarcodeList: (List\u003cBarcode\u003e barcode) async {\n        if (isPop) { // Prevent multiple pop\n          return;\n        }\n        if (barcode.isEmpty) return;\n        isPop = true;\n        Navigator.of(context).pop(barcode);\n      },\n      scanValue: ScanValue(),\n    );\n  }\n}\n\n```\n\n\u003c/details\u003e\n\n### Scan and show dialog in current page\n\n\u003cdetails\u003e\n\n\u003csummary\u003eClick to expand code\u003c/summary\u003e\n\n```dart\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:scan_barcode/scan_barcode.dart';\n\nclass ShowDialogExample extends StatelessWidget {\n  const ShowDialogExample({\n    Key? key,\n  }) : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    return BarcodeScanPage(\n      title: 'Show dialog when scanned',\n      onHandleBarcodeList: (List\u003cBarcode\u003e barCode) async {\n        if (barCode.isEmpty) return;\n        await showBarcodeListDialog(\n            context, barCode); // The await is important, if you don't await, multiple dialogs will be shown.\n      },\n    );\n  }\n\n  Future\u003cvoid\u003e showBarcodeListDialog(BuildContext context, List\u003cBarcode\u003e barCode) async {\n    await showDialog(\n      context: context,\n      builder: (context) =\u003e\n          AlertDialog(\n            title: const Text('Barcode list'),\n            content: Column(\n              mainAxisSize: MainAxisSize.min,\n              children: [\n                for (final barcode in barCode)\n                  ListTile(\n                    title: Text(barcode.rawValue ?? ''),\n                    subtitle:\n                    Text('type: ${barcode.type}, format: ${barcode.format}'),\n                    trailing: IconButton(\n                      icon: const Icon(Icons.copy),\n                      onPressed: () {\n                        Clipboard.setData(\n                          ClipboardData(text: barcode.rawValue ?? ''),\n                        );\n                      },\n                    ),\n                  ),\n              ],\n            ),\n            actions: [\n              ElevatedButton(\n                onPressed: () {\n                  Navigator.of(context).pop();\n                },\n                child: const Text('OK'),\n              ),\n            ],\n          ),\n    );\n  }\n}\n```\n\n\u003c/details\u003e\n\n### Examples\n\n- [How to change config](example/lib/examples/change_camera_config_example.dart)\n- [How to custom barcode rect](example/lib/examples/change_qrcode_rect.dart)\n- [One shot scan](example/lib/examples/scan_and_pop_page_example.dart)\n- [Show the barcode list dialog when scanned](example/lib/examples/show_dialog_example.dart)\n\n## dependencies\n\n- [flutter](https://github.com/flutter/flutter)\n- [camera](https://pub.dev/packages/camera)\n- [google_mlkit_barcode_scanning](https://pub.dev/packages/google_mlkit_barcode_scanning)\n\n## Common\n\n### Using in flutter 2.x\n\nBecause of the upstream API modification, only `0.1.0` can be used on Flutter 2.x.x.\nAdd the following code to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  scan_barcode: ^0.1.0\n\ndependency_overrides:\n  google_mlkit_barcode_scanning:\n    git:\n      url: https://gitee.com/kikt/Google-Ml-Kit-plugin.git\n      ref: barcode-0.5.0-forked\n      path: packages/google_mlkit_barcode_scanning\n```\n\n## LICENSE\n\nApache License 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fscan_barcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffluttercandies%2Fscan_barcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffluttercandies%2Fscan_barcode/lists"}