show method

Log show([
  1. BuildContext? context
])

Implementation

Log show([BuildContext? context]) {
  try {
    context ??= navigatorGlobalKey.currentState?.context;
    if (context != null && context.mounted) {
      if (code >= 500) {
        return Alert(context).showSnackbar(message,
            toast: Toast.LENGTH_LONG,
            textColor: Colors.white,
            backgroundColor: Colors.red);
      } else if (code == 400) {
        return Alert(context).showSnackbar(message,
            toast: Toast.LENGTH_LONG,
            textColor: Colors.white,
            backgroundColor: Colors.amber);
      } else if (code == 200) {
        return Alert(context).showSnackbar(message,
            toast: Toast.LENGTH_LONG,
            textColor: Colors.white,
            backgroundColor: Colors.blue);
      }
      return Alert(context).showSnackbar(message, toast: Toast.LENGTH_LONG);
    }
  } catch (e) {}
  return this;
}