Skip to content

Instantly share code, notes, and snippets.

View eduardoflorence's full-sized avatar

Eduardo Florence eduardoflorence

View GitHub Profile
@eduardoflorence
eduardoflorence / main.dart
Created October 5, 2020 22:02
Dart Future - Testes de timeout
// Problema: then está sendo executado mesmo que timeout e catchError seja acionado
void main() {
final item = teste()
.then((value) => print('Executou then'))
.timeout(Duration(seconds: 2),
onTimeout: () {
throw ('Timeout expirado');
}
)
.catchError((e) => print('Erro $e'))