for instance if we have access to several attributes of entity class A, like a.b, a.c and have expression involved them like if (a.b.i == a.c.j) count++, we will need nested future or future Future.wait
Future.wait([a.b, a.c])
.then((List responses) { if((responses[0] as B).i == (responses[1] as C).j) count++;} )
.catchError((e) => handleError(e));
this is huge increase of code side.and very awkward to use case operator,
these are very artificial constrants intorduced by using future.
If we need to write code in this way, it will be a big pain.
Also if we need to share count variable from other codes, actually above code won't work.
We may need to replace count to Future<int> count.
and all other code which need to access count must be invoked by wait
Future<int> count4 = future.wait([count1, count2, count3])
.then((List responses) {
int i1 = responses[0] as int;
int i2 = responses[1] as int;
int i3 = responses[2] as int;
completer.completed(i1+i2+i4);
return compreter.future;
} ).then(lisner1).then(listen2)..
.catchError((e) => handleError(e));connt.then((_){..})
I wonder who can keep writing this kind of codes, and if situation got more complicated,
it will be impossible to write manageable code in this style.
Sharing state among futures will be very difficult.
Also if count4 is update, how to do? at least it won't as simple as count++.
also listener may be a function which may be invoked form outside and it may need to access count4.
then such fuction must return as as future which will be triggered by completing count value.
In this way, future constraint cascade to every where, which I see in postgresql cases.
In particular, caching base implementation, the first access may be slow,
but the rest will be on memory, so very fast, no need to use Future.