More background refreshing

This commit is contained in:
2024-06-15 16:33:30 +02:00
parent 35ab9a26c0
commit eea219a205
8 changed files with 180 additions and 128 deletions

View File

@@ -0,0 +1,18 @@
// 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.
class ImmediateFuture<T> {
final Future<T> future;
final T? value;
ImmediateFuture(this.future, this.value);
ImmediateFuture.ofFuture(Future<T> v)
: future = v,
value = null;
ImmediateFuture.ofValue(T v)
: future = Future.value(v),
value = v;
}