initializeDateFormatting function Null safety

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

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 url. The url parameter should end with a "/". For example, "http://localhost:8000/dates/"

Implementation

Future<void> initializeDateFormatting(String locale, String url) {
  var reader = HttpRequestDataReader('${url}symbols/');
  initializeDateSymbols(() => LazyLocaleData(
      reader, _createDateSymbol, availableLocalesForDateFormatting));
  var reader2 = HttpRequestDataReader('${url}patterns/');
  initializeDatePatterns(() =>
      LazyLocaleData(reader2, (x) => x, availableLocalesForDateFormatting));
  var actualLocale =
      Intl.verifiedLocale(locale, availableLocalesForDateFormatting.contains);
  return initializeIndividualLocaleDateFormatting((symbols, patterns) {
    return Future.wait(<Future<List<dynamic>>>[
      symbols.initLocale(actualLocale),
      patterns.initLocale(actualLocale)
    ]);
  });
}