FakeCarPlatform class
A car that lives in memory, for tests.
It behaves like the native side: it keeps its own screen stack, closes an alert before reporting a tap on it, and keeps only the root when the car disconnects. Drive it with tap, pressBack, connect and disconnect, and check what the car shows with screens and alert.
- Inheritance
-
- Object
- PlatformInterface
- TechproCarPlatform
- FakeCarPlatform
Constructors
- FakeCarPlatform()
-
Creates a fake with no car connected. Use install to also make it
the platform of
TechproCar.instance.
Properties
-
alert
↔ Map<
String, Object?> ? -
The alert the car shows, if any.
getter/setter pair
-
calls
→ List<
String> -
Every call from Dart, in order, e.g.
push,pop.final - hashCode → int
-
The hash code for this object.
no setterinherited
- isConnected → bool
-
Whether a car is connected.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
screenIds
→ List<
String> -
The ids of screens, root first.
no setter
-
screens
→ List<
Map< String, Object?> > -
The screens the car shows, root first, as sent by Dart.
final
Methods
-
connect(
[CarPlatform platform = CarPlatform.carPlay]) → Future< void> - Connects a car of the given kind.
-
disconnect(
) → Future< void> - Disconnects the car. Like the real one, it keeps only the root.
-
dismissAlert(
) → Future< void> -
Closes the alert, if one is shown.
override
-
failNext(
String method) → void -
Makes the next call named
methodfail with a PlatformException. -
getConnection(
) → Future< Map< String, Object?> > -
Returns the current connection, in the same format as the
connectionChangedevent.override -
hold(
) → void - Keeps every following call from Dart pending until release.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pop(
) → Future< void> -
Removes the top screen.
override
-
popToRoot(
) → Future< void> -
Removes every screen except the root.
override
-
pressBack(
) → Future< void> - Presses Back in the car: closes the alert, or goes back one screen.
-
push(
Map< String, Object?> template) → Future<void> -
Shows
templateon top of the current screen.override -
release(
) → void - Lets held calls finish.
-
sendEvent(
String name, Map< String, Object?> args) → Future<void> - Sends a raw event as the native side would, e.g. one that a newer version of techpro_carplay might send.
-
setEventHandler(
CarEventHandler? handler) → void -
Sets the function that receives native events, or
nullto stop.override -
setRoot(
Map< String, Object?> template) → Future<void> -
Replaces the whole screen stack with
template.override -
showAlert(
Map< String, Object?> alert) → Future<void> -
Shows
alerton top of the current screen.override -
tap(
String elementId) → Future< void> -
Taps the row, grid item or button with
elementIdon the alert, if one is shown, or else on the top screen. Completes when the app's callback has finished. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
Map< String, Object?> template) → Future<void> -
Replaces the screen whose id matches
templatein place.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
install(
) → FakeCarPlatform -
Makes a fake the platform of a fresh
TechproCar.instance.