diff --git a/packages/flutter_tools/lib/src/localizations/gen_l10n_types.dart b/packages/flutter_tools/lib/src/localizations/gen_l10n_types.dart index d4c6f12c8db..e6d78c1128c 100644 --- a/packages/flutter_tools/lib/src/localizations/gen_l10n_types.dart +++ b/packages/flutter_tools/lib/src/localizations/gen_l10n_types.dart @@ -283,6 +283,9 @@ class Placeholder { if (value == null) { return null; } + if (value is bool) { + return value; + } if (value != 'true' && value != 'false') { throw L10nException( 'The "$attributeName" value of the "$name" placeholder in message $resourceId ' diff --git a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart index c3c28b362fa..068bb6830f9 100644 --- a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart +++ b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart @@ -1658,6 +1658,28 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e expect(content, contains(r"DateFormat('asdf o\'clock', localeName)")); }); + testWithoutContext('handle arbitrary formatted date with actual boolean', () { + setupLocalizations({ + 'en': ''' +{ + "@@locale": "en", + "springBegins": "Spring begins on {springStartDate}", + "@springBegins": { + "description": "The first day of spring", + "placeholders": { + "springStartDate": { + "type": "DateTime", + "format": "asdf o'clock", + "isCustomDateFormat": true + } + } + } +}''' + }); + final String content = getGeneratedFileContent(locale: 'en'); + expect(content, contains(r"DateFormat('asdf o\'clock', localeName)")); + }); + testWithoutContext('throws an exception when no format attribute is passed in', () { expect( () {