Work on implementing search filter in app [WIP]

This commit is contained in:
2024-09-19 19:46:46 +02:00
parent 9d35916280
commit 3adeadf6fb
23 changed files with 898 additions and 48 deletions

View File

@@ -1,18 +1,26 @@
// This class is useful togther with FutureBuilder
// Unfortunately Future.value(x) in FutureBuilder always results in one frame were snapshot.connectionState is waiting
// Whit way we can set the ImmediateFuture.value directly and circumvent that.
// This way we can set the ImmediateFuture.value directly and circumvent that.
class ImmediateFuture<T> {
final Future<T> future;
final T? value;
T? _futureValue = null;
ImmediateFuture(this.future, this.value);
ImmediateFuture.ofFuture(Future<T> v)
: future = v,
value = null;
value = null {
future.then((v) => _futureValue = v);
}
ImmediateFuture.ofValue(T v)
: future = Future.value(v),
value = v;
T? get() {
return value ?? _futureValue;
}
}