flagsSet property
Set<AnnotationFlag> ?
get
flagsSet
Gets the flags as a Set of AnnotationFlag enums. Decodes from the internal JSON string representation. Skips any flag names that don't match a valid AnnotationFlag value (e.g., Web SDK may return 'noPrint' which maps to the 'print' flag).
Implementation
Set<AnnotationFlag>? get flagsSet {
final flags = _decodeFlags(flagsJson);
if (flags == null) return null;
// Map Web SDK flag names to AnnotationFlag enum names.
// The Web SDK uses 'noPrint' (inverted logic), while AnnotationFlag uses 'print'.
const webToFlutterFlagMap = <String, String>{
'noPrint': 'print',
};
final result = <AnnotationFlag>{};
for (final name in flags) {
final mappedName = webToFlutterFlagMap[name] ?? name;
try {
result.add(AnnotationFlag.values.byName(mappedName));
} catch (_) {
// Skip unrecognized flag names gracefully
}
}
return result;
}