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-09-28 11:36:01 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e967f54f049fa5bf92dea1678ff0fb44eba0c975
e967f54f
1 parent
d346a45a
use const for barcode event name
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletions
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/method_channel/mobile_scanner_method_channel.dart
View file @
e967f54
...
...
@@ -16,6 +16,10 @@ import 'package:mobile_scanner/src/objects/start_options.dart';
/// An implementation of [MobileScannerPlatform] that uses method channels.
class
MethodChannelMobileScanner
extends
MobileScannerPlatform
{
/// The name of the barcode event that is sent when a barcode is scanned.
@visibleForTesting
static
const
String
kBarcodeEventName
=
'barcode'
;
/// The name of the error event that is sent when a barcode scan error occurs.
@visibleForTesting
static
const
String
kBarcodeErrorEventName
=
'MOBILE_SCANNER_BARCODE_ERROR'
;
...
...
@@ -141,7 +145,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
// Handle incoming barcode events.
// The error events are transformed to `MobileScannerBarcodeException` where possible.
return
eventsStream
.
where
((
e
)
=>
e
[
'name'
]
==
'barcode'
)
.
where
((
e
)
=>
e
[
'name'
]
==
kBarcodeEventName
)
.
map
((
event
)
=>
_parseBarcode
(
event
))
.
handleError
(
_parseBarcodeError
);
}
...
...
Please
register
or
login
to post a comment