extract_messages library Null safety

This is for use in extracting messages from a Dart program using the Intl.message() mechanism and writing them to a file for translation. This provides only the stub of a mechanism, because it doesn't define how the file should be written. It provides an IntlMessage class that holds the extracted data and parseString and parseFile methods which can extract messages that conform to the expected pattern: (parameters) => Intl.message("Message $parameters", desc: ...); It uses the analyzer package to do the parsing, so may break if there are changes to the API that it provides. An example can be found in test/message_extraction/extract_to_json.dart

Note that this does not understand how to follow part directives, so it has to explicitly be given all the files that it needs. A typical use case is to run it on all .dart files in a directory.


A particular message extraction run.


computeMessageName(String name, String? text, String? meaning) String?
If a message is a string literal without interpolation, compute a name based on that and the meaning, if present.


OnMessage = void Function(String message)
A function that takes a message and does something useful with it.