DwFakePushTransport class final

A transport whose SDK is this object, for widget tests: the token, the permission and the taps come when the test says.

final transport = DwFakePushTransport(issuedToken: 'device-1');
// build the core with DwPush(transports: [transport]) …
transport.open(DwPushData(payload: NewsAlert(id: 12)));
Inheritance

Constructors

DwFakePushTransport({DwPushTransport transport = DwPushTransport.fcm, bool supported = true, bool available = true, bool granted = true, String? issuedToken, Map<Object?, Object?>? initialOpen})

Properties

attachCount ↔ int
How many times the plugin attached to it.
getter/setter pair
available → bool
final
granted ↔ bool
Whether permission is granted; requestPermission grants it.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
isAttached → bool
Whether the plugin is listening.
no setter
issuedToken ↔ String?
The token the platform issues once permission is granted.
getter/setter pair
isSupportedPlatform → bool
Whether this transport can run on the platform of this build — answered without touching its SDK.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supported → bool
final
transport → DwPushTransport
What the device registers its token as; the server sends through this transport's provider only.
final

Methods

attach(DwPushTransportEvents events) → Future<void>
Starts listening. Called once, before token.
override
detach() → Future<void>
override
isAvailable() → Future<bool>
Whether it can run on this device now (RuStore installed, a Firebase app initialized). Asked only when isSupportedPlatform.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
open(DwPushData data, {DwPushOpenSource source = DwPushOpenSource.background}) → void
The user opened a notification carrying data.
openRaw(Map<Object?, Object?> data, {DwPushOpenSource source = DwPushOpenSource.background}) → void
The user opened a notification with this raw provider data map.
permission() → Future<DwPushPermission>
override
receive(Map<Object?, Object?> data, {String? title, String? body}) → void
A notification arrived while the app was on screen.
refreshToken(String token) → void
The platform refreshed the token.
requestPermission() → Future<DwPushPermission>
Asks the user; a refusal is an answer, not an error.
override
takeInitialOpen() → Future<Map<Object?, Object?>?>
The data of the notification that started the app, consumed once.
override
token() → Future<String?>
The current token, or null while the platform will not issue one (no permission, no APNs token yet).
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited