add method

dynamic add(
  1. BuildContext context,
  2. dynamic currentValue,
  3. int loop
)

Implementation

dynamic add(BuildContext context, dynamic currentValue, int loop) {
  if (currentValue is! num) {
    context.logsCubit.onNewLog(
      EditorLogEntity(
        id: id,
        content: 'The value is not a number',
        createdAt: DateTime.now(),
      ),
    );
  }
  final res = value.get(context: context, loop: loop);
  if (res is! num) {
    context.logsCubit.onNewLog(
      EditorLogEntity(
        id: id,
        content: 'The second value is not a number',
        createdAt: DateTime.now(),
      ),
    );
    return currentValue;
  }
  return currentValue / res;
}