skip to Main Content

Error: ‘DatePickerTheme’ is imported from both ‘package:flutter/src/material/date_picker_theme.dart’ and

‘package:flutter_datetime_picker/src/datetime_picker_theme.dart’.

I just want to solve this error in Flutter I stuck here for more than 3 hours. Help me to solve this with a genuine solution. I tried to find the package and removed it from there but it didn’t solve.

2

Answers


  1. Actually, the error says that Flutter SDK and that package use the same class DatePickerTheme,

    If you want to use the same class from the package then use the import as below syntax:

    package:flutter_datetime_picker/src/datetime_picker_theme.dart as fdp
    

    then in code use the fdp.(your desired method from that package)

    That’s it.
    Happy Fluttering 💙

    Login or Signup to reply.
  2. The DatPickerTheme class is defined in material/date_picker_theme.dart and also defined in package of dateTimePicker

    import 'package:flutter_datetime_picker/src/datetime_picker_theme.dart' as fdp;
    

    use it like this:

    fdp.DatePickerTheme
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search