FakeOkapiPlatform class
An in-memory OkapiPlatform for tests.
- Inheritance
-
- Object
- OkapiPlatform
- FakeOkapiPlatform
Constructors
-
FakeOkapiPlatform({Map<
OkapiPermission, OkapiStatus> statuses = const {}, Map<OkapiPermission, OkapiStatus> requestResults = const {}, Map<OkapiPermission, OkapiServiceStatus> services = const {}, Set<OkapiPermission> undeclared = const {}, Map<OkapiPermission, bool> rationale = const {}, Map<String, String> store = const {}, OkapiDeviceInfo device = const OkapiDeviceInfo.unknown(), Set<OkapiOemScreen> oemScreens = const {}, OkapiAutoResetStatus autoReset = OkapiAutoResetStatus.notAvailable, OkapiAutoResetStatus? onAutoResetSettingsReturn}) - Creates a fake. Unlisted permissions start as OkapiStatus.denied.
Properties
- autoReset ↔ OkapiAutoResetStatus
-
What autoResetStatus returns.
getter/setter pair
- autoResetSettingsOpened ↔ int
-
How many times auto-reset settings were opened.
getter/setter pair
- device ↔ OkapiDeviceInfo
-
What deviceInfo returns.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
oemScreens
→ Set<
OkapiOemScreen> -
Phone-maker screens that "exist".
final
- onAutoResetSettingsReturn ↔ OkapiAutoResetStatus?
-
Applied when auto-reset settings are opened.
getter/setter pair
-
onSettingsReturn
↔ Map<
OkapiPermission, OkapiStatus> ? -
Status to apply when settings are opened (simulates the user flipping
the switch).
nullleaves statuses unchanged.getter/setter pair -
openedOemScreens
→ List<
OkapiOemScreen> -
Every phone-maker screen opened, in order.
final
-
rationale
→ Map<
OkapiPermission, bool> -
shouldShowRationale answers.
final
-
requestResults
→ Map<
OkapiPermission, OkapiStatus> -
What each request returns. Unlisted: the current status.
final
-
requests
→ List<
List< OkapiPermission> > -
Every request made, in order.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
services
→ Map<
OkapiPermission, OkapiServiceStatus> -
Service states.
final
- settingsOpened ↔ int
-
How many times app settings were opened.
getter/setter pair
-
statuses
→ Map<
OkapiPermission, OkapiStatus> -
Current statuses (mutable).
final
-
store
→ Map<
String, String> -
The on-device store (mutable).
final
-
undeclared
→ Set<
OkapiPermission> -
Permissions treated as missing from the manifest / Info.plist.
final
Methods
-
autoResetStatus(
) → Future< OkapiAutoResetStatus> -
Whether Android may remove permissions when the app is unused.
override
-
availableOemScreens(
) → Future< Set< OkapiOemScreen> > -
Which phone-maker screens exist on this phone (Android only).
override
-
checkServiceStatus(
OkapiPermission permission) → Future< OkapiServiceStatus> -
Whether the related system service is switched on.
override
-
checkStatus(
OkapiPermission permission) → Future< OkapiStatus> -
Current status without showing any UI.
override
-
deviceInfo(
) → Future< OkapiDeviceInfo> -
Basic facts about the phone.
override
-
isDeclared(
OkapiPermission permission) → Future< bool> -
Whether the permission is declared in AndroidManifest.xml / Info.plist.
override
-
loadStore(
) → Future< Map< String, String> > -
Loads Okapi's small on-device store (timestamps, counters, flags).
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openAppSettings(
) → Future< bool> -
Opens this app's page in system settings.
override
-
openAutoResetSettings(
) → Future< bool> -
Opens the screen where the user can turn auto-reset off for this app.
override
-
openOemScreen(
OkapiOemScreen screen) → Future< bool> -
Opens a phone-maker screen. Returns false when it doesn't exist.
override
-
openServiceSettings(
OkapiPermission permission) → Future< bool> -
Opens the settings page of the related service (for example Location).
Falls back to the app's settings page when the platform has none.
override
-
request(
List< OkapiPermission> permissions, {Map<String, Object?> options = const {}}) → Future<Map< OkapiPermission, OkapiStatus> > -
Shows the system dialog (or special settings screen) for each
permission and returns the resulting statuses.
override
-
shouldShowRationale(
OkapiPermission permission) → Future< bool> -
Android: whether the system recommends explaining before asking.
Always false on iOS.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
writeStore(
String key, String? value) → Future< void> -
Writes one store value;
nullremoves it.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited