fromPubspec static method
Implementation
static Future<GenerationOptions> fromPubspec(BuildStep buildStep) async {
final pubspecId = await buildStep.findAssets(Glob('pubspec.yaml')).first;
final pubspecData = await buildStep.readAsString(pubspecId);
final pubspec = loadYaml(pubspecData) as YamlMap;
final packageOptions = pubspec['package_options'] as YamlMap?;
final messagesOptions = packageOptions?['messages_builder'] as YamlMap?;
final generationOptions = GenerationOptions(
serialization: SerializationType.json,
deserialization: DeserializationType.web,
messageCalls: (messagesOptions?['generateMethods'] as bool?) ?? true,
findById: (messagesOptions?['generateFindById'] as bool?) ?? false,
indexType: _indexType(messagesOptions),
header: messagesOptions?['header'] as String? ??
'Generated by package:messages_builder.',
pluralSelector: _pluralSelector(messagesOptions),
);
return generationOptions;
}