Using DataTime in an app_en.arb file produces an error during code generation.
Example app_en.arb that reproduces the error:
{
"helloWorldOn": "Hello World on {date}",
"@helloWorldOn": {
"description": "A message with a date parameter",
"placeholders": {
"date": {
"type": "DateTime",
"format": "yMd"
}
}
}
}
Error shown:
.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart:12:11: Error: 'intl.DateFormat' can't be used as a type because 'intl' doesn't refer to an import prefix.
final intl.DateFormat dateDateFormat = intl.DateFormat.yMd(localeName);
^^^^^^^^^^^^^^^
.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart:12:44: Error: The getter 'intl' isn't defined for the class 'AppLocalizationsEn'.
- 'AppLocalizationsEn' is from 'package:flutter_gen/gen_l10n/app_localizations_en.dart' ('.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'intl'.
final intl.DateFormat dateDateFormat = intl.DateFormat.yMd(localeName);
Using
DataTimein anapp_en.arbfile produces an error during code generation.Example
app_en.arbthat reproduces the error:{ "helloWorldOn": "Hello World on {date}", "@helloWorldOn": { "description": "A message with a date parameter", "placeholders": { "date": { "type": "DateTime", "format": "yMd" } } } }Error shown: