runFunction method
Implementation
Future<dynamic> runFunction(
BuildContext context, ListViewAction action, int loop) async {
try {
final controller = getVariable(context.pageState, action);
if (controller.scrollController == null) {
context.read<AppLogsCubit>().onNewLog(
EditorLogEntity(
id: _uuid.v1(),
content: 'List View Controller not found',
createdAt: DateTime.now(),
),
);
return;
}
if (action is ScrollToIndexAction) {
scrollToIndex(controller.scrollController!, action.index);
return;
}
if (action is ReorderListViewAction) {
reorder(context, context.pageState, action.nodeID, action.index, loop,
(_, __) {});
return;
}
throw Exception('No function found');
} catch (e) {
context.read<AppLogsCubit>().onNewLog(
EditorLogEntity(
id: _uuid.v1(),
content: e.toString(),
createdAt: DateTime.now(),
),
);
}
return;
}