flutter_web_qrcode_scanner 1.1.1 copy "flutter_web_qrcode_scanner: ^1.1.1" to clipboard
flutter_web_qrcode_scanner: ^1.1.1 copied to clipboard

Platformweb

Camera-based QR code scanning for Flutter-Web, The package makes use of the jsQR.js library to gain native access to the camera and scan QR codes

📷 flutter_web_qrcode_scanner #

Flutter Web plugin for scanning QR codes

🛠️ Getting Started #

Firstly you need to add this plugin flutter_web_qrcode_scanner:1.1.1 to your pubspec.yaml file.

dependencies:
  flutter_web_qrcode_scanner:1.1.1

Then you need to add <script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js"></script> to your index.html file after body tag.

  <script src="https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.min.js"></script>

🏃 Usage #

Auto play example, The video preview (scanning area) will start automatically

 FlutterWebQrcodeScanner(
    cameraDirection: CameraDirection.back,
    stopOnFirstResult: true, //set false if you don't want to stop video preview on getting first result
    onGetResult: (result) {
           // _result = jsonDecode(result);
    },
    //width:200,
    //height:200,
 )

You are able to choose the scanning camera via the cameraDirection attribute CameraDirection.back or CameraDirection.front,

If you want to control the start and stop of camera scanning, you must use the CameraController attribute

CameraController _controller = CameraController(autoPlay: false);

then you can start and stop video preview by calling methods startVideoStream() and stopVideoStream()


InkWell(
  //some code
  onTap:(){
    _controller.startVideoStream();
    },
)
.
.
.
FlutterWebQrcodeScanner(
  controller: _controller,
  onGetResult: (result) {
            // some code
         _controller.stopVideoStream();
      },
    )
3
likes
140
pub points
77%
popularity

Publisher

unverified uploader

Camera-based QR code scanning for Flutter-Web, The package makes use of the jsQR.js library to gain native access to the camera and scan QR codes

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on flutter_web_qrcode_scanner