@override FutureOr<String> generateForAnnotatedElement( Element element, ConstantReader annotation, BuildStep buildStep) { final ElementAnnotation elementAnnotation = element.metadata.first; // Read the source directly instead of using `ConstantReader annoation` final source = elementAnnotation.toSource(); final value = source.substring( '@ObjectAnnotation('.length, source.length - 1, ); return 'const ${element.displayName} = $value;'; } } @ObjectAnnotation(Platform.android) ⬇ Platform.android