flutter intl 0.17.0-nullsafety.2 package initializeDateFormatting

Viewed 646

i need some help because im going crazy. I just want to format date to my locale (should be it-IT).

In flutter app i putted in pubspec.yaml the intl package with the new nullsafety feature:

  flutter:
    sdk: flutter
  intl: ^0.17.0-nullsafety.2 

looking into the documentation it says:

<< Note that before doing any DateTime formatting for a particular locale, you must load the appropriate data by calling: >>

import 'package:intl/date_symbol_data_local.dart';
...
initializeDateFormatting('de_DE', null).then(formatDates); 

(https://pub.dev/packages/intl/versions/0.17.0-nullsafety.2)

so, just to try, i did:

initializeDateFormatting('it-IT', null).then((value) => {print('intl ok')});

but the dart nullsafety doesnt want a null parameter, and it says "The argument type 'Null' can't be assigned to the parameter type 'String'."

Any suggestion?

0 Answers
Related