Created
February 3, 2023 01:48
-
-
Save VB10/4af049580ffb2e2b401af36273bbd7d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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