initializeDateFormatting function Null safety

Future<void> initializeDateFormatting(
  1. String locale,
  2. String filePath
)

This should be called for at least one locale before any date formatting methods are called. It sets up the lookup for date symbols using path. The path parameter should end with a directory separator appropriate for the platform.

Implementation

Future<void> initializeDateFormatting(String locale, String filePath) {
  var reader = FileDataReader(path.join(filePath, 'symbols'));
  initializeDateSymbols(() => LazyLocaleData(
      reader, _createDateSymbol, availableLocalesForDateFormatting));
  var reader2 = FileDataReader(path.join(filePath, 'patterns'));
  initializeDatePatterns(() =>
      LazyLocaleData(reader2, (x) => x, availableLocalesForDateFormatting));
  return initializeIndividualLocaleDateFormatting((symbols, patterns) {
    return Future.wait(<Future<dynamic>>[
      symbols.initLocale(locale),
      patterns.initLocale(locale)
    ]);
  });
}