Stream.periodic(Duration(seconds: 1)).takeWhile((_) => myValue == null).listen(
(_) {
print("Value is still null, checking again...");
if (myValue != null) {
print("Value is not null. Stopping periodic check.");
print("Method is called because value is not null.");
}
},
);
Comments
Post a Comment