hydrated icon indicating copy to clipboard operation
hydrated copied to clipboard

why hydrate take time and have to use Future.delay()

Open jahir9991 opened this issue 4 years ago • 2 comments

jahir9991 avatar Sep 30 '21 05:09 jahir9991

Hi @jahir9991, could you please provide a code sample?

solid-software avatar Jan 04 '22 12:01 solid-software

Hi @solid-software For example, I have a subject like that:

final _connect = HydratedSubject<bool>("_connect", seedValue: false);

And it already has true value, then on the application start (from the main(), for example) I do like that:

print("start ${_connect.value}");
await Future.delayed(const Duration(milliseconds: 100)); // To wake Hydrated
print("start ${_connect.value}");

Console log would be:

false
true

If there is no seed value subject will throw an exception.

narritt avatar Aug 07 '22 09:08 narritt