Type-safe substitutions #153
-
I am wondering if it is possible to achieve type-safe substitutions with this library. I had a glimpse into its docs, but I cannot really tell if this functionality is supported. My current strategy and its annoyancesSo far I used a very simplistic approach: through JSON files. I created the class that handles the JSON files myself and everything works. However, it is not really type-safe: I would like the IDE to show an error when i did not enter all substitutions (or at least Example of my translate function: AppLocalizations.of(context)!.translate(String jsonKey, [
Map<String, String>? substitutions,
]); A concrete example: AppLocalizations.of(context)!.translate('add_account'); That key/value pair in the JSON file: "add_account": "Aggiungi account", Another example, with substitutions this time: AppLocalizations.of(context)!.translate('0_results_for', {'searchedText': 'Paolo'}); That key/value pair in the JSON file: "0_results_for": "Zero risultati per '{{ searchedText }}'", (which displays 'Zero risultati per Paolo'). However, had i only entered |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I had a look again and it clearly does ( |
Beta Was this translation helpful? Give feedback.
I had a look again and it clearly does (
String b = t.game.end.highscore(score: 32.6);
).