handleHiddenAccountOperation method
Future<void>
handleHiddenAccountOperation(
{ - required String operationName,
- String? customErrorMessage,
- required Future<void> authOperation(),
})
Implementation
Future<void> handleHiddenAccountOperation({
required String operationName,
String? customErrorMessage,
required Future<void> Function() authOperation,
}) async {
try {
await authOperation();
} catch (error) {
Get.snackbar(
'$operationName failed',
customErrorMessage == null
? '$error'
: '$customErrorMessage: $error',
snackPosition: SnackPosition.BOTTOM,
borderRadius: 4,
margin: const EdgeInsets.all(0),
);
if (kDebugMode) {
String message =
customErrorMessage == null
? '$error'
: '$customErrorMessage: $error';
print(
'Snackbar dialog: $operationName has failed $message',
);
}
return;
}
}