I am trying to omit passing name and arguments into Intl.message
. Intl
documentation suggests that, there is a transformer provided that will automatically insert those parameters for you.
So I added following into pubspec.yaml
:
dev_dependencies:
intl_translation: ^0.17.3
transformers:
- intl_translation:
$include: lib/localization.dart
In my localization.dart
I have following method:
class AppLocalizations {
...
String greetingMessage(String name) => Intl.message(
"Hello $name!",
desc: "Greet the user as they first open the application",
examples: const {'name': "Emily"});
}
When I run flutter pub pub run intl_translation:extract_to_arb --output-dir=strings lib/localization.dart
I have the following error:
<Intl.message("Hello $name!", desc: "Greet the user as they first open the application", examples: const {'name' : "Emily"})>
reason: The 'args' argument for Intl.message must be specified for messages with parameters. Consider using rewrite_intl_messages.dart
How I can enable that transformer?