MobileReaderSdk class abstract
Unified Flutter façade for the EasyMerchant mobile card readers.
This is the contract that POS applications (FULL and LITE) consume. The Android and iOS native bridges are responsible for implementing it; this file defines the shape of the API, the lifecycle, and the constraints.
Method channels are intentionally not wired up in this branch. The default implementation provided here throws UnimplementedError for every operation; a platform-channel implementation will land in a follow-up branch alongside the matching native bridges.
Lifecycle
initialize(config) // exactly once per app run
|
v
discoverReaders({timeout}) // returns discovered devices via events
|
v
connect(reader) // becomes the active reader
|
v
startTransaction(request) // emits reader events; returns terminal result
|
v
disconnect() // releases the active reader
cancelTransaction may be called between startTransaction and a
terminal event. getStatus may be called at any time.
Architecture constraints
- This SDK captures encrypted card payloads. It never holds the PAN, CVV, or full track data, and never authorizes a payment.
em-apiowns gateway authorization. The SDK forwards the encrypted payload through em-api and reports back whatever em-api returns. The SDK does not synthesize approval or auth codes on its own.- The POS app owns checkout UX, sale state, tip/tax math, and receipts. The SDK reports events; the POS decides what they mean for the cart.
- Implementers
Constructors
- MobileReaderSdk()
- Default constructor for subclasses (the future MethodChannel-backed implementation, in-memory fakes for tests, etc.).
Properties
-
events
→ Stream<
ReaderEvent> -
Single unified event stream for the SDK. See ReaderEvent for
the shape; see ReaderEventType for the list of events.
no setter
- 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. -
connect(
ReaderDevice reader) → Future< void> -
Connect to a previously-discovered reader. Emits
connectingthenconnectedon success;failed(carrying a ReaderError) on failure. -
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. -
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.
-
getStatus(
) → Future< ReaderStatus> - Snapshot of the current SDK / reader state.
-
initialize(
ReaderConfig config) → Future< void> - Initialize the SDK with POS-supplied configuration.
-
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.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ MobileReaderSdk
-
The default instance used by the public top-level API.
getter/setter pair