Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
mobile_scanner
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Navaron Bracke
2024-04-30 11:38:12 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
51c786d17797cbf14063f3d99153876e95fc1528
51c786d1
1 parent
3c0c45a8
let web throw when start is called once the barcode reader is set
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
lib/src/mobile_scanner_controller.dart
lib/src/web/mobile_scanner_web.dart
lib/src/mobile_scanner_controller.dart
View file @
51c786d
...
...
@@ -280,6 +280,9 @@ class MobileScannerController extends ValueNotifier<MobileScannerState> {
);
}
}
on
MobileScannerException
catch
(
error
)
{
// TODO: if the error code is `controllerAlreadyInitialized` ignore the error
// TODO: update the error reporting from the native side to report proper error codes.
// The initialization finished with an error.
// To avoid stale values, reset the output size,
// torch state and zoom scale to the defaults.
...
...
lib/src/web/mobile_scanner_web.dart
View file @
51c786d
...
...
@@ -253,6 +253,17 @@ class MobileScannerWeb extends MobileScannerPlatform {
@override
Future
<
MobileScannerViewAttributes
>
start
(
StartOptions
startOptions
)
async
{
// TODO: ignore double starts in the controller.
if
(
_barcodeReader
!=
null
)
{
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
controllerAlreadyInitialized
,
errorDetails:
MobileScannerErrorDetails
(
message:
'The scanner was already started. Call stop() before calling start() again.'
,
),
);
}
_barcodeReader
=
ZXingBarcodeReader
();
await
_barcodeReader
?.
maybeLoadLibrary
(
...
...
@@ -260,6 +271,7 @@ class MobileScannerWeb extends MobileScannerPlatform {
);
if
(
_barcodeReader
?.
isScanning
??
false
)
{
// TODO: ignore double starts in the controller.
throw
const
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
controllerAlreadyInitialized
,
errorDetails:
MobileScannerErrorDetails
(
...
...
Please
register
or
login
to post a comment