Skip to content

Instantly share code, notes, and snippets.

@VB10
Created February 3, 2023 01:48
Show Gist options
  • Save VB10/4af049580ffb2e2b401af36273bbd7d4 to your computer and use it in GitHub Desktop.
Save VB10/4af049580ffb2e2b401af36273bbd7d4 to your computer and use it in GitHub Desktop.
class GlobalException {
static Future<T?> make<T>(AsyncValueGetter<T?> onOperation) async {
try {
final response = await onOperation.call();
if (response == null) {
throw Exception('$T data is null $response');
}
return response;
} catch (e) {
//logger
print('$e $T');
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment