log function
Implementation
void log(String? log, {BuildContext? context, String logLevel = PRINTED_LOG}) {
if (log != null && currentContext != null) {
debugPrint(log);
BuildContext ctx = context ?? currentContext!;
try {
switch (logLevel) {
case CONSOLE_LOG:
if (onConsoleLog != null) onConsoleLog!(log);
// Provider.of<UiState>(ctx, listen: false).addLog(log);
break;
case TOAST_MESSAGE:
showToast(log,
context: ctx,
backgroundColor: Theme.of(ctx).colorScheme.inversePrimary,
position: const ToastPosition(align: Alignment.topRight));
break;
case POP_UP_MESSAGE:
_showInfoAlert(log);
break;
}
} catch (e) {
debugPrint(e.toString());
}
}
}