runFunction method

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

Implementation

Future<dynamic> runFunction(
    BuildContext context, ConsoleAction action) async {
  try {
    if (action is ConsolePrintAction) {
      context.logsCubit.onNewLog(
        EditorLogEntity(
          id: _uuid.v1(),
          content: action.content,
          createdAt: DateTime.now(),
        ),
      );
      return;
    }
    throw Exception('No function found');
  } catch (e) {
    context.logsCubit.onNewLog(
      EditorLogEntity(
        id: _uuid.v1(),
        content: e.toString(),
        createdAt: DateTime.now(),
      ),
    );
  }
  return;
}