juliansteenbakker / mobile_scanner

A universal scanner for Flutter based on MLKit. Uses CameraX on Android and AVFoundation on iOS.
BSD 3-Clause "New" or "Revised" License
891 stars 515 forks source link

Official document error #1240

Open jsleemaster opened 1 day ago

jsleemaster commented 1 day ago

Error

The getter 'hasCameraPermission' isn't defined for the type 'MobileScannerState'. Try importing the library that defines 'hasCameraPermission', correcting the name to the name of an existing getter, or defining a getter or field named 'hasCameraPermission'.

There is an error with the hasCameraPermission option in the idChangeAppLifeState method part in the official document. Which part should it be replaced with? Can you correct it?

Currently, I am checking with isInitialized option.

navaronbracke commented 1 day ago

This getter is defined here: https://github.com/juliansteenbakker/mobile_scanner/blob/master/lib/src/objects/mobile_scanner_state.dart#L66

What version of mobile_scanner are you using? The getter was introduced in version 6.0.0, as stated in the changelog.

https://github.com/juliansteenbakker/mobile_scanner/blob/master/CHANGELOG.md#600

If you do not want to upgrade to that version, you can just do the check yourself, too.

For that, you'll need to check both isInitialized and error?.errorCode != MobileScannerErrorCode.permissionDenied