패키지, 저장소 및 앱 카테고리 검색

패키지 상세v4.9.0

barcode_scan2

카메라를 통해 2차원 바코드 및 QR 코드를 스캔하는 Flutter 플러그인입니다.

AndroidiOS
30일 다운로드
2.1만
좋아요
307
Pub 점수
160

패키지 설치

flutter pub add barcode_scan2

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

barcode_scan2는 디바이스의 카메라를 사용하여 2차원 바코드와 QR 코드를 스캔할 수 있는 Flutter 플러그인입니다. 이 플러그인은 Flutter 애플리케이션에 바코드 스캔 기능을 통합하기 위한 간단하고 신뢰할 수 있는 인터페이스를 제공합니다. Android 및 iOS 플랫폼을 모두 지원하므로 크로스플랫폼 모바일 개발에 적합합니다. 최소한의 설정으로 소매, 물류, 티켓팅 등 다양한 분야에서 사용되는 앱에 스캔 기능을 빠르게 추가할 수 있습니다. 소스 코드는 GitHub에서 공개되어 있어 투명성과 맞춤형 수정이 가능합니다.

사용 사례

  • 소매 재고 관리
  • 이벤트 티켓 스캔
  • 제품 정보 조회
  • 물류 추적
  • QR 코드를 통한 사용자 인증

주요 기능

  • 실시간 바코드 스캔
  • 2차원 바코드 및 QR 코드 지원
  • 크로스 플랫폼 호환성 (Android 및 iOS)
  • Flutter와의 간단한 통합
  • 오픈소스이며 사용자 정의 가능

적합한 대상

  • 바코드 스캔이 필요한 모바일 앱
  • 재고 또는 티켓 시스템을 구축하는 개발자
  • 빠른 QR 코드 데이터 검색이 필요한 프로젝트
  • Android 및 iOS 사용자를 대상으로 하는 앱

고려 사항

  • 모든 플랫폼에서 카메라 권한이 필요합니다
  • 최적의 사용자 경험을 위해 추가적인 UI 컴포넌트가 필요할 수 있습니다
  • 성능은 장치 카메라 품질에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

GitHub license GitHub stars Pub GitHub forks

Reborned🎉

Original barcode_scan was discontinued, so barcode_scan2 was borned with sound null safety support🎉

barcode_scan2

A flutter plugin for scanning 2D barcodes and QR codes.

This provides a simple wrapper for two commonly used iOS and Android libraries:

  • iOS: https://github.com/mikebuss/MTBBarcodeScanner
  • Android: https://github.com/dm77/barcodescanner
Features
  • [x] Scan 2D barcodes
  • [x] Scan QR codes
  • [x] Control the flash while scanning
  • [x] Permission handling

Getting Started

Android

For Android, you must do the following before you can use the plugin:

  • Add the camera permission to your AndroidManifest.xml

    <uses-permission android:name="android.permission.CAMERA" />

  • This plugin is written in Kotlin. Therefore, you need to add Kotlin support to your project. See installing the Kotlin plugin.

Edit your project-level build.gradle file to look like this:

buildscript {
    ext.kotlin_version = '1.3.61'
    // ...
    dependencies {
        // ...
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
// ...

Edit your app-level build.gradle file to look like this:

apply plugin: 'kotlin-android'
// ...
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    // ...
}

Now you can depend on the barcode_scan plugin in your pubspec.yaml file:

dependencies:
    # ...
    barcode_scan2: any

Click "Packages get" in Android Studio or run flutter packages get in your project folder.

iOS

To use on iOS, you must add the the camera usage description to your Info.plist

<dict>
    <!-- ... -->
    <key>NSCameraUsageDescription</key>
    <string>Camera permission is required for barcode scanning.</string>
    <!-- ... -->
</dict>
iOS 26+ Compatibility

This fork includes a fix for the 10-15 second delay when dismissing the scanner on iOS 26+. The fix is built-in - no additional configuration required.

Usage

import 'package:barcode_scan2/barcode_scan2.dart';

void main() async {
  var result = await BarcodeScanner.scan();

  print(result.type); // The result type (barcode, cancelled, failed)
  print(result.rawContent); // The barcode content
  print(result.format); // The barcode format (as enum)
  print(result.formatNote); // If a unknown format was scanned this field contains a note
}

Advanced usage

You can pass options to the scan method:

import 'package:barcode_scan2/barcode_scan2.dart';

void main() async {

  var options = ScanOptions(
    // set the options
  );

  var result = await BarcodeScanner.scan(options: options);

  // ...
}
Supported options
Option Type Description Supported by
strings.cancel String The cancel button text on iOS iOS only
strings.flash_on String The flash on button text iOS + Android
strings.flash_off String The flash off button text iOS + Android
restrictFormat BarcodeFormat[] Restrict the formats which are recognized iOS + Android
useCamera int The index of the camera which is used for scanning (See BarcodeScanner.numberOfCameras) iOS + Android
autoEnableFlash bool Enable the flash when start scanning iOS + Android
android.aspectTolerance double Enable auto focus on Android Android only
android.useAutoFocus bool Set aspect ratio tolerance level used in calculating the optimal Camera preview size Android only
android.appBarTitle String Sets the text of the app bar Android only

Development setup

Setup protobuf

Mac:

$ brew install protobuf
$ brew install swift-protobuf

Windows / Linux: https://github.com/protocolbuffers/protobuf#protocol-compiler-installation

Activate the protobuf dart plugin:

$ flutter pub global activate protoc_plugin

Install theProtobuf Support plugin for IDEA / Android Studio or vscode-proto3 for VS Code

If you changed the protos.proto you've to execute the ./generate_proto.sh to update the dart / swift sources

Common problems

Android "Could not find org.jetbrains.kotlin:kotlin-stdlib-jre..."

Change org.jetbrains.kotlin:kotlin-stdlib-jre to org.jetbrains.kotlin:kotlin-stdlib-jdk (StackOverflow)

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트