Skip to content

DateFormat crashes for unsupported locale "cnr_ME" instead of falling back #1004

@NitinArya2001

Description

@NitinArya2001

When using intl.DateFormat in Flutter/Dart with the locale "cnr_ME" (Montenegrin), the formatter throws an error because the locale is not supported in intl’s locale tables.

On Android native (ICU/libcore), unsupported locales gracefully fallback:
"cnr_ME" → "sr_ME" → "sr" → "en"

But in Flutter’s intl package, the fallback is missing and it crashes.

This breaks apps when the device language/region is set to "cnr_ME".

Expected Behavior

  intl should fallback like Android’s ICU/libcore:

If "cnr_ME" is unsupported, try "sr_ME", then "sr", then "en".

Actual Behavior

  intl throws:
  
  FormatException: Locale data has not been initialized for locale cnr_ME.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions