i18n
i18n copied to clipboard
`initializeDateFormatting` examples in the documentation use null when not allowed
The DateFormat documentation (as of intl 0.18.1) includes examples for calling initializeDateFormatting:
import 'package:intl/date_symbol_data_file.dart'; initializeDateFormatting('de_DE', null).then((_) => runMyCode());
import 'package:intl/date_symbol_data_http_request.dart'; initializeDateFormatting('pt_BR', null).then((_) => runMyCode());
Those examples are no longer legal since those two implementations of initializeDateFormatting take a non-null String as their second argument. (However, note that the implementation from date_symbol_data_local.dart does have nullable parameter types.)
The fact that the documentation is wrong brings me to the problem that I do not understand how to initialize intl correctly.
I alway get the error:
"Locale en_US has not been initialized. Call initializeDateFormatting(en_US, data url) first"
But I do not know what to use as "data url".
But I do not know what to use as "data url".
Is your import for initializeDateFormatting from import 'package:intl/date_symbol_data_local.dart';?
Thanks, my error was using import 'package:intl/date_symbol_data_file.dart'; instead of ..._local