generate method
List<Field>
generate(
)
override
Implementation
@override
List<Field> generate() {
final loadingStrategy = Field(
(fb) {
final returnType = const Reference('Future<String>').symbol;
fb
..name = '_fileLoader'
..modifier = FieldModifier.final$
..type = Reference('$returnType Function(String id)');
},
);
final currentLocale = Field(
(fb) => fb
..type = const Reference('String')
..name = '_currentLocale'
..assignment = Code("'$locale'"),
);
final messages = Field(
(fb) => fb
..modifier = FieldModifier.final$
..type = const Reference('Map<String, MessageList>')
..name = '_messages'
..assignment = const Code('{}'),
);
final dataFiles = Field(
(fb) {
final paths = localeToResourceInfo.entries
.map((e) => "'${e.key}' : ('${e.value.path}', '${e.value.hasch}')")
.join(',');
fb
..name = '_dataFiles'
..modifier = FieldModifier.constant
..static = true
..assignment = Code('{$paths}');
},
);
final pluralSelector = Field(
(fb) => fb
..name = 'pluralSelector'
..type = const Reference(
'''Message Function(num howMany, {Map<int, Message>? numberCases, Map<int, Message>? wordCases, Message? few, Message? many, Message other, String? locale})'''),
);
final fields = [
loadingStrategy,
currentLocale,
messages,
dataFiles,
if (options.pluralSelector == PluralSelectorType.custom) pluralSelector,
];
return fields;
}