FakeAssetSource class final

Fake asset source.

Implemented types

Constructors

FakeAssetSource({PickerPermission permission = PickerPermission.full, List<PickerAlbum> albumList = const <PickerAlbum>[], Map<String, List<PickerAsset>> assetsByAlbum = const <String, List<PickerAsset>>{}})
Creates a FakeAssetSource.

Properties

albumList ↔ List<PickerAlbum>
What albums returns.
getter/setter pair
albumQueries → List<FakeAlbumQuery>
The album queries.
final
assetQueries → List<FakeAssetQuery>
The asset queries.
final
assetsByAlbum ↔ Map<String, List<PickerAsset>>
Album id → its assets, newest first.
getter/setter pair
changes → Stream<void>
Fires when the library changes — a new capture, a changed limited selection, a deletion.
no setteroverride
failingFiles → Set<String>
Ids whose file call throws.
final
filesById → Map<String, File>
Ids whose file returns this exact file. Checked before the synthetic /fake/$id fallback, so a test that needs real bytes on disk — a length, a probe, an export — writes a temp file and registers it here.
final
hashCode → int
The hash code for this object.
no setterinherited
locallyUnavailable → Set<String>
Ids for which isLocallyAvailable reports false.
final
manageLimitedSelectionCalls ↔ int
How many times manageLimitedSelection was called.
getter/setter pair
missingFiles → Set<String>
Ids whose file resolves to null: present in the library, not obtainable. The iCloud case of spec §4.5, which the /fake/$id fallback cannot express.
final
pendingFiles → Set<String>
Ids whose file future the test completes by hand, via completeFile.
final
permission ↔ PickerPermission
What requestPermission returns.
getter/setter pair
permissionRequests → List<Set<PickerMediaType>>
The permission requests.
final
prefetchQueries → List<FakePrefetchQuery>
The prefetch queries.
final
prefetchThrows ↔ bool
Makes prefetch throw, so callers can be proved to guard.
getter/setter pair
queryDelay ↔ Duration?
Artificial latency for albums and assets.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
savedCaptures → List<CapturedMedia>
Captures handed to saveToLibrary, in order.
final
saveResult ↔ PickerAsset?
What saveToLibrary returns. Null models a platform save that produced nothing the picker can surface.
getter/setter pair
saveThrows ↔ bool
When true, saveToLibrary throws instead of returning.
getter/setter pair
thumbnailBytes ↔ Uint8List
What thumbnail returns. A non-empty placeholder by default so callers that only care about "some bytes arrived" need no setup.
getter/setter pair

Methods

albums(Set<PickerMediaType> kinds, {Duration? maxVideoDuration}) → Future<List<PickerAlbum>>
Lists albums, filtering videos longer than maxVideoDuration at query time.
override
assets({required PickerAlbum album, required int offset, required int count}) → Future<List<PickerAsset>>
One page of album, newest first.
override
completeFile(String id, File? file) → void
Completes a held-open file call.
dispose() → Future<void>
Closes the change stream. Call from addTearDown.
emitChange() → void
Emits a library-changed event.
emitFileProgress(String id, double progress) → void
Feeds a progress value to a held-open file call.
file(String id, {void onProgress(double)?, TransformCancelToken? cancelToken}) → Future<File?>
The asset's file, downloading from iCloud if necessary.
override
isLocallyAvailable(String id) → Future<bool>
Whether the full asset exists on the device right now.
override
manageLimitedSelection(Set<PickerMediaType> kinds) → Future<void>
Presents the OS "manage limited selection" UI.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
prefetch(List<String> ids, ThumbSize size, {int quality = 85}) → Future<void>
Asks the platform to warm its thumbnail cache for ids.
override
requestPermission(Set<PickerMediaType> kinds) → Future<PickerPermission>
Requests library access for kinds and reports the resulting state.
override
saveToLibrary(CapturedMedia capture) → Future<PickerAsset?>
Saves a camera capture into the device library and returns it as a library asset.
override
thumbnail(String id, ThumbSize size, {int quality = 85}) → Future<Uint8List?>
Thumbnail bytes for id. quality is pinned by the caller on purpose — the platform defaults differ between overloads (design §4.4).
override
toString() → String
A string representation of this object.
inherited

Operators

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