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
2023-10-22 14:27:29 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a73459827e217bfe3729d29a198f1c1a5b1db2ae
a7345982
1 parent
f9752708
handle more exception types in cast
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
lib/src/mobile_scanner.dart
lib/src/mobile_scanner.dart
View file @
a734598
...
...
@@ -2,6 +2,8 @@ import 'dart:async';
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:mobile_scanner/src/enums/mobile_scanner_error_code.dart'
;
import
'package:mobile_scanner/src/mobile_scanner_controller.dart'
;
import
'package:mobile_scanner/src/mobile_scanner_exception.dart'
;
import
'package:mobile_scanner/src/objects/barcode_capture.dart'
;
...
...
@@ -138,11 +140,31 @@ class _MobileScannerState extends State<MobileScanner>
widget
.
onStart
?.
call
(
arguments
);
widget
.
onScannerStarted
?.
call
(
arguments
);
}).
catchError
((
error
)
{
if
(
mounted
)
{
setState
(()
{
_startException
=
error
as
MobileScannerException
;
});
if
(!
mounted
)
{
return
;
}
if
(
error
is
MobileScannerException
)
{
_startException
=
error
;
}
else
if
(
error
is
PlatformException
)
{
_startException
=
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorDetails:
MobileScannerErrorDetails
(
code:
error
.
code
,
message:
error
.
message
,
details:
error
.
details
,
),
);
}
else
{
_startException
=
MobileScannerException
(
errorCode:
MobileScannerErrorCode
.
genericError
,
errorDetails:
MobileScannerErrorDetails
(
details:
error
,
),
);
}
setState
(()
{});
});
}
...
...
Please
register
or
login
to post a comment