FutureOr<B> flatMap<B>(FutureOr<B> Function(A a) f) { if (this is Future) { return (this as Future<A>).then(f); } return f(this as A); }