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-11-03 17:42:47 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
fcc66d73a6939e1198400a927818481f2a820628
fcc66d73
1 parent
9d7cf2db
add platform interface stub
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
0 deletions
lib/mobile_scanner.dart
lib/src/method_channel/mobile_scanner_method_channel.dart
lib/src/mobile_scanner_platform_interface.dart
pubspec.yaml
lib/mobile_scanner.dart
View file @
fcc66d7
...
...
@@ -12,6 +12,7 @@ export 'src/enums/torch_state.dart';
export
'src/mobile_scanner.dart'
;
export
'src/mobile_scanner_controller.dart'
;
export
'src/mobile_scanner_exception.dart'
;
export
'src/mobile_scanner_platform_interface.dart'
;
export
'src/objects/address.dart'
;
export
'src/objects/barcode.dart'
;
export
'src/objects/barcode_capture.dart'
;
...
...
lib/src/method_channel/mobile_scanner_method_channel.dart
0 → 100644
View file @
fcc66d7
import
'package:flutter/foundation.dart'
;
import
'package:flutter/services.dart'
;
import
'package:mobile_scanner/src/mobile_scanner_platform_interface.dart'
;
/// An implementation of [MobileScannerPlatform] that uses method channels.
class
MethodChannelMobileScanner
extends
MobileScannerPlatform
{
/// The method channel used to interact with the native platform.
@visibleForTesting
final
methodChannel
=
const
MethodChannel
(
'dev.steenbakker.mobile_scanner/scanner/method'
);
/// The event channel that sends back scanned barcode events.
@visibleForTesting
final
eventChannel
=
const
EventChannel
(
'dev.steenbakker.mobile_scanner/scanner/event'
);
}
...
...
lib/src/mobile_scanner_platform_interface.dart
0 → 100644
View file @
fcc66d7
import
'package:mobile_scanner/src/method_channel/mobile_scanner_method_channel.dart'
;
import
'package:plugin_platform_interface/plugin_platform_interface.dart'
;
/// The platform interface for the `mobile_scanner` plugin.
abstract
class
MobileScannerPlatform
extends
PlatformInterface
{
/// Constructs a MobileScannerPlatform.
MobileScannerPlatform
()
:
super
(
token:
_token
);
static
final
Object
_token
=
Object
();
static
MobileScannerPlatform
_instance
=
MethodChannelMobileScanner
();
/// The default instance of [MobileScannerPlatform] to use.
///
/// Defaults to [MethodChannelMobileScanner].
static
MobileScannerPlatform
get
instance
=>
_instance
;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [MobileScannerPlatform] when
/// they register themselves.
static
set
instance
(
MobileScannerPlatform
instance
)
{
PlatformInterface
.
verifyToken
(
instance
,
_token
);
_instance
=
instance
;
}
}
...
...
pubspec.yaml
View file @
fcc66d7
...
...
@@ -25,6 +25,7 @@ dependencies:
flutter_web_plugins
:
sdk
:
flutter
js
:
"
>=0.6.3
<0.8.0"
plugin_platform_interface
:
^2.0.2
dev_dependencies
:
flutter_test
:
...
...
Please
register
or
login
to post a comment