MethodChannelMobileReaderSdk class
Method-channel + event-channel backed implementation of MobileReaderSdk.
Talks to the Android (ReaderMethodHandler) and iOS
(ReaderMethodHandler) skeletons over the channels declared in
MobileReaderChannels. The wire shape is identical to the
Dart models' toJson / fromJson output - this adapter does not
invent a second schema.
Status. As of this branch the native skeletons return
unsupported_operation for connect and startTransaction (the
hardware adapters land in dedicated follow-ups). This Dart
adapter therefore surfaces those PlatformExceptions as
structured ReaderError(code: 'unsupported_operation') from the
public API; the Future does not hang and the events stream
continues to receive the synthetic lifecycle events the native
skeletons already emit.
- Inheritance
-
- Object
- MobileReaderSdk
- MethodChannelMobileReaderSdk
Constructors
- MethodChannelMobileReaderSdk({MethodChannel? methodChannel, EventChannel? eventChannel})
-
Build with the default channels. Pass non-defaults from tests
to inject mocked
MethodChannel/EventChannelinstances.
Properties
-
events
→ Stream<
ReaderEvent> -
Single unified event stream for the SDK. See
ReaderEventfor the shape; see ReaderEventType for the list of events.no setteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelTransaction(
) → Future< void> -
Cancel the in-progress transaction. Emits a
cancelledevent and causes the startTransaction future to complete with a TransactionResultStatus.cancelled result.override -
connect(
ReaderDevice reader) → Future< void> -
Connect to a previously-discovered reader. Emits
connectingthenconnectedon success;failed(carrying a ReaderError) on failure.override -
disconnect(
) → Future< void> -
Disconnect from the currently-connected reader. Emits
disconnectedon success. Safe to call when nothing is connected; it is a no-op in that case.override -
discoverReaders(
{Duration? timeout}) → Future< void> -
Begin scanning for nearby readers. Discovered readers are emitted
as ReaderEventType.readerDiscovered events on events; a
terminal ReaderEventType.discoveryCompleted event marks the end
of the scan window.
override
-
getStatus(
) → Future< ReaderStatus> -
Snapshot of the current SDK / reader state.
override
-
initialize(
ReaderConfig config) → Future< void> -
Initialize the SDK with POS-supplied configuration.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startTransaction(
TransactionRequest request) → Future< TransactionResult> -
Begin a transaction. Emits the reader prompts and card-data
events on events; the returned future completes with the
terminal TransactionResult once the gateway response (via
em-api) is known or the operation otherwise resolves.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited