|
|
@ -43,7 +43,7 @@ abstract class InteractiveBloc extends Bloc { |
|
|
|
_errorsStreamController.add(error); |
|
|
|
_errorsStreamController.add(error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Wraps the action [call]. |
|
|
|
/// Wraps the given [action]. |
|
|
|
/// |
|
|
|
/// |
|
|
|
/// If [disableTimeout] is `true` [RequestManager] will apply the default |
|
|
|
/// If [disableTimeout] is `true` [RequestManager] will apply the default |
|
|
|
/// timeout. On success the state will be refreshed through the [refresh] |
|
|
|
/// timeout. On success the state will be refreshed through the [refresh] |
|
|
@ -52,15 +52,15 @@ abstract class InteractiveBloc extends Bloc { |
|
|
|
@protected |
|
|
|
@protected |
|
|
|
// ignore: avoid_void_async |
|
|
|
// ignore: avoid_void_async |
|
|
|
void wrapAction( |
|
|
|
void wrapAction( |
|
|
|
final AsyncCallback call, { |
|
|
|
final AsyncCallback action, { |
|
|
|
final bool disableTimeout = false, |
|
|
|
final bool disableTimeout = false, |
|
|
|
final AsyncCallback? refresh, |
|
|
|
final AsyncCallback? refresh, |
|
|
|
}) async { |
|
|
|
}) async { |
|
|
|
try { |
|
|
|
try { |
|
|
|
if (disableTimeout) { |
|
|
|
if (disableTimeout) { |
|
|
|
await call(); |
|
|
|
await action(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
await RequestManager.instance.timeout(call); |
|
|
|
await RequestManager.instance.timeout(action); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await (refresh ?? this.refresh)(); |
|
|
|
await (refresh ?? this.refresh)(); |
|
|
|