getWarningAndErrors method

  1. @override
EditorWarningAndErrorsEntity getWarningAndErrors(
  1. ID nodeID,
  2. BuildContext context
)
override

Implementation

@override
EditorWarningAndErrorsEntity getWarningAndErrors(
  ID nodeID,
  BuildContext context,
) {
  if (variableID == null) {
    return EditorWarningAndErrorsEntity(errors: [
      EditorErrorEntity(
        message: 'Variable ID is required',
        nodeID: nodeID,
      ),
    ]);
  }
  try {
    context.getVariableById(
        variableID: variableID!, cubitID: cubitID!, stateID: stateID!);
  } catch (e) {
    return EditorWarningAndErrorsEntity(errors: [
      EditorErrorEntity(
        message: 'Variable not found',
        nodeID: nodeID,
      ),
    ]);
  }
  return EditorWarningAndErrorsEntity.clear();
}