I am using localisation in a flutter app but also want to localise the date format using initialise date formatting. My main looks like this ...
void main() {
runApp(new MaterialApp(
supportedLocales:
[const Locale('en', 'US'),
const Locale('en', 'AU')],
localizationsDelegates: [
const DemoLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
],
home: new ThirdPageWidget(),
navigatorObservers: [routeObserver],
));
}
Also I have a initializeDateFormatting in a stateful widget like this ...
@override
void initState() {
super.initState();
initializeDateFormatting().then((_) {
dateFormat = new DateFormat.yMd('en_AU');
print(dateFormat.format(DateTime.now()));
});
Now when the locale is en_AU the format of the date is month/day/year american style but when I remove this line of code
GlobalMaterialLocalizations.delegate,
The date correctly displays day/month/year. Does any one know what I can do to fix this? How important is it to have the GlobalMaterialLocalizations.delegate?
import 'package:flutter_localizations/flutter_localizations.dart';
– Printer