createFlutterDeps function
LexioLabDeps
createFlutterDeps({
- LLStorageMode storage = LLStorageMode.auto,
- Client? httpClient,
- DateTime now()?,
- Directory? storageDirectory,
- void warn(
- String message
Builds the real dependencies.
storageDirectory is resolved LAZILY, on the first cache access, so
constructing a client never awaits a platform channel and the first frame
never waits for the disk.
Implementation
LexioLabDeps createFlutterDeps({
LLStorageMode storage = LLStorageMode.auto,
http.Client? httpClient,
DateTime Function()? now,
Directory? storageDirectory,
void Function(String message)? warn,
}) {
final http.Client client = httpClient ?? http.Client();
return LexioLabDeps(
fetch: _httpFetch(client),
storage: switch (storage) {
LLStorageMode.off => const LLNullStorage(),
LLStorageMode.memory => LLMemoryStorage(),
LLStorageMode.auto => LLLazyFileStorage(storageDirectory),
},
now: now ?? DateTime.now,
hash: sha256Hash,
// A microtask, not a post-frame callback: the core's boot must not wait for
// a frame that a headless test will never produce.
defer: scheduleMicrotaskDefer,
warn: warn ?? _defaultWarn,
);
}