firstWhere static method
Implementation
static Future<String> firstWhere(bool Function(String element) test) {
for (final e in currentApi!._calledEndpoints.entries) {
if (e.value.isNotEmpty && test(e.key)) {
return Future.value(e.key);
}
}
final completer = Completer<String>();
StreamSubscription<String>? sub;
sub = currentApi!._apiCallStream.stream.listen((action) {
if (test(action)) {
sub?.cancel();
completer.complete(action);
}
});
return completer.future;
}