NetLensFileMockRepository class
Repository which saves mocks to a JSON file, so mocks recorded once can be replayed after the app is restarted. The file has the format of NetLensMockJsonCodec, so it can be shared and loaded in tests.
- Implemented types
Constructors
- NetLensFileMockRepository(File file, {NetLensMockJsonCodec codec = const NetLensMockJsonCodec()})
Properties
- file → File
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
mocksStream
→ Stream<
List< NetLensMock> > -
Stream which returns all mocks on change.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Removes all mocks.
override
-
getMocks(
) → List< NetLensMock> -
Returns all mocks in the order they were added.
override
-
load(
) → Future< void> - Reads mocks saved in file. Call it once before the mocks are used. A missing or broken file leaves the repository empty.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String id) → Future< void> -
Removes the mock with
id.override -
save(
NetLensMock mock) → Future< void> -
Adds
mock, or replaces the mock which has the same id.override -
saveAll(
Iterable< NetLensMock> mocks) → Future<void> -
Adds or replaces all
mocksat once.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited