initializeDateFormattingCustom function Null safety

void initializeDateFormattingCustom(
  1. {String? locale,
  2. DateSymbols? symbols,
  3. Map<String, String>? patterns}

This should be called for at least one locale before any date formatting methods are called.

It sets up the lookup for date information. The symbols argument should contain a populated DateSymbols, and patterns should contain a Map for the same locale from skeletons to the specific format strings. For examples, see date_time_patterns.dart.

If data for this locale has already been initialized it will be overwritten.


void initializeDateFormattingCustom(
    {String? locale, DateSymbols? symbols, Map<String, String>? patterns}) {
  if (symbols == null) {
    throw ArgumentError('Missing DateTime formatting symbols');
  if (patterns == null) {
    throw ArgumentError('Missing DateTime formatting patterns');
  if (locale != symbols.NAME) {
    throw ArgumentError.value(
        [locale, symbols.NAME], 'Locale does not match symbols.NAME');
  dateTimeSymbols[symbols.NAME] = symbols;
  dateTimePatterns[symbols.NAME] = patterns;