tryCatch<T> function
T?
tryCatch<T>(
- T worker(), [
- T? onError(
- dynamic e
Implementation
T? tryCatch<T>(T Function() worker, [T? Function(dynamic e)? onError]) {
try {
return worker();
} catch (e) {
return onError?.call(e);
}
}