runFunction method

Future runFunction(
  1. NavigatorAction action,
  2. BuildContext context
)

Implementation

Future<dynamic> runFunction(
  NavigatorAction action,
  BuildContext context,
) async {
  try {
    if (action is ChangePageAction) {
      await changePage(action, context);
      return;
    }
    if (action is ShowDialogAction) {
      await showCDialog(action, context);
      return;
    }
    if (action is ShowBottomSheetAction) {
      await showCBottomSheet(action, context);
      return;
    }
    if (action is PopAction) {
      return pop(context);
    }
    throw Exception('No function found');
  } catch (e) {
    context.read<AppLogsCubit>().onNewLog(
          EditorLogEntity(
            id: _uuid.v1(),
            content: e.toString(),
            createdAt: DateTime.now(),
          ),
        );
  }
  return;
}