getWarningAndErrors method
Implementation
@override
EditorWarningAndErrorsEntity getWarningAndErrors(
ID nodeID,
BuildContext context,
) {
if (type == FFillType.solid) {
if (levels.isEmpty) {
return EditorWarningAndErrorsEntity(
warnings: const [],
errors: [
EditorErrorEntity(
nodeID: nodeID,
message: 'Levels is empty',
),
],
);
}
if (levels.first.color.length != 3 || levels.first.color.length != 6) {
return EditorWarningAndErrorsEntity(
warnings: [
EditorWarningEntity(
nodeID: nodeID,
message: 'Hex code is not valid',
),
],
errors: const [],
);
}
}
if (type == FFillType.variable) {
if (variableID == null) {
return EditorWarningAndErrorsEntity(
warnings: const [],
errors: [
MissingVariableWarningEntity(
nodeID: nodeID,
message: 'VariableID is null',
),
],
);
}
}
if (type == FFillType.json) {
if (jsonGetAttribute == null) {
return EditorWarningAndErrorsEntity(
warnings: const [],
errors: [
EditorErrorEntity(
nodeID: nodeID,
message: 'JsonGetAttribute is null',
),
],
);
}
return jsonGetAttribute!.getWarningAndErrors(nodeID, context);
}
if (type == FFillType.style) {
if (paletteStyle == null) {
return EditorWarningAndErrorsEntity(
warnings: const [],
errors: [
EditorErrorEntity(
nodeID: nodeID,
message: 'PaletteStyle is null',
),
],
);
} else {
final style = context.stylesState.colorStyles[paletteStyle];
if (style == null) {
return EditorWarningAndErrorsEntity(
warnings: const [],
errors: [
EditorErrorEntity(
nodeID: nodeID,
message: 'Color style not found',
),
],
);
}
}
}
return EditorWarningAndErrorsEntity.clear();
}