getWarningAndErrors method
Implementation
@override
EditorWarningAndErrorsEntity getWarningAndErrors(
ID nodeID, BuildContext context) {
if (cubitID == null || stateID == null || variableID == null) {
return EditorWarningAndErrorsEntity(
errors: [
EditorErrorEntity(
message: 'Cubit, state and variable must be set',
nodeID: nodeID,
),
],
);
}
final cubit = context.getCubitByID(cubitID!);
final state = cubit.states[stateID!]!;
final variable = state.fields[variableID!];
if (variable.runtimeType is JsonVar && jsonAttribute == null) {
return EditorWarningAndErrorsEntity(
errors: [
EditorErrorEntity(
message: 'Json attribute must be set for json variable',
nodeID: nodeID,
),
],
);
}
if (variable is ModelVar && modelAttribute == null) {
return EditorWarningAndErrorsEntity(
errors: [
EditorErrorEntity(
message: 'Model attribute must be set for model variable',
nodeID: nodeID,
),
],
);
}
if (variable is ModelListVar && modelAttribute == null) {
return EditorWarningAndErrorsEntity(
errors: [
EditorErrorEntity(
message: 'Model attribute must be set for model variable',
nodeID: nodeID,
),
],
);
}
return const EditorWarningAndErrorsEntity();
}