How to change language of Show date picker in flutter

I followed @Darshan's answer but I got the following error:

Unsupported operation: Cannot set value in unmodifiable Map

after I removed await initializeDateFormatting('fr_FR'); from main.dart it worked!

In order to show the date picker in local language, you need to make use of flutter_localizations plugin and specify localizationDelegates and supportedLocales inside MaterialApp in your main code. Below is sample working code that shows datepicker in French:

  1. Add flutter_localizations plugin in pubspec.yaml and run pub get.
    sdk: flutter  
  1. Import the plugin in dart file.
import 'package:flutter_localizations/flutter_localizations.dart';
  1. Inside MaterialApp, add following:

     return MaterialApp(
           localizationsDelegates: [
           supportedLocales: [
             const Locale('en'),
             const Locale('fr')
   child: ElevatedButton(
     child: const Text('Tap'),
       onPressed: () {
            context: context,
            locale: const Locale("fr", "FR"),
            firstDate: DateTime(2018),
            lastDate: DateTime(2030),
            builder: (BuildContext context, Widget? child) {
              return Theme(
                data: ThemeData.dark(),
                child: child!,
  1. Run app again (hot restart) and see that datepicker shows up in French.

More info about localization can be found on the official docs

enter image description here