flutter_datetime_picker icon indicating copy to clipboard operation
flutter_datetime_picker copied to clipboard

Error: DatePickerTheme' isn't a function.

Open AKovynev opened this issue 2 years ago • 5 comments

Today I am getting an error: 'DatePickerTheme' isn't a function. Try correcting the name to match an existing function, or define a method or function named 'DatePickerTheme'. image

AKovynev avatar Feb 07 '23 05:02 AKovynev

Any solutions? We should wait for fix?

sarp86 avatar Feb 26 '23 16:02 sarp86

It may seem irrelevant, but when I referenced the package from github, not pubdev, this problem was solved.

SerdarYildiz06 avatar Mar 20 '23 11:03 SerdarYildiz06

It may seem irrelevant, but when I referenced the package from github, not pubdev, this problem was solved.

This didn't work out in my case, I still get the error. I'm referencing the package as such :

  flutter_datetime_picker:
    git:
      url: https://github.com/Realank/flutter_datetime_picker.git
      ref: master

ajayprakashshukla avatar Jun 23 '23 06:06 ajayprakashshukla

It may seem irrelevant, but when I referenced the package from github, not pubdev, this problem was solved.

This didn't work out in my case, I still get the error. I'm referencing the package as such :

  flutter_datetime_picker:
    git:
      url: https://github.com/Realank/flutter_datetime_picker.git
      ref: master

I fixed this earlier internally. All I did was to rename the DatePickerTheme being imported from 'package:flutter_datetime_picker/src/datetime_picker_theme.dart' as it's conflicting with Flutter's native DatePickerTheme function. Or you can refer to the fix on this PR that fixes the issue using aliases.

Anyitechs avatar Oct 31 '23 11:10 Anyitechs

You can try this Change to this and use dtpicker or any name you want

import 'package:flutter_datetime_picker/flutter_datetime_picker.dart' as dtpicker;

After

dtpicker.DatePicker(...)
or
dtpicker.DatePickerTheme(...)

rs-huypq avatar Dec 02 '23 18:12 rs-huypq