Replies: 3 comments 5 replies
-
This is an interesting example, could you provide some more code as an example? |
Beta Was this translation helpful? Give feedback.
5 replies
-
This is the behavior of the Inject postsSignal << [Post(id:1,message:"received"),Post(id:2,message:"received"),] What could be the best returned value? void operator <<(Iterable<T> other) import 'package:signals/signals.dart';
void main() {
final s1 = Stream.fromIterable([1, 2, 3]);
final resolve = asyncSignalFromFuture(
() => Future.delayed(Duration(seconds: 1), () => true),
initialValue: false);
final as1 = asyncSignalFromStream(() => s1, initialValue: 0);
effect(() {
if (resolve()) as1 << [4, 5, 6];
});
effect(() {
final rs = as1();
print("$rs");
});
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Working on a big refactor to AsyncSignal and it will allow for manual usage: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment
AsyncSignal
has no public constructor and can only be used in combination with aFuture
or aStream
, where the determination of the possible states (value, loading, reloading, error) are performed internally.Sometimes i have cases where that
async
procedure is not possible, e.g. when using fpdart for data requests, where i get back e.g. aFuture<Either<ApiException, List<Post>>>
type, which imo cannot be handled byAsyncSignal
.Therefore it would be great to see if
AsyncSignal
could allow setting its states (currently_AsyncState
) and corresponding data (value, exception) from outside as well in order to have 3 ways of usingAsyncSignal
(fromFuture
, fromStream
and manually).Beta Was this translation helpful? Give feedback.
All reactions