catchAll function
- Function function,
- {ErrorCallback onError}
Runs the function
and ignore all the errors.
Runs function ErrorCallback onError
when there is an error
Returns true
whether there is no error.
Implementation
bool catchAll(Function function, {ErrorCallback onError}) {
try {
function();
return true;
} catch (error) {
if (onError != null) {
onError(error);
}
}
return false;
}