/C:/Users/DL/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker-1.5.1/lib/flutter_datetime_picker.dart:6:1: Error: ‘DatePickerTheme’ is imported from both ‘package:flutter/src/material/date_picker_theme.dart’ and ‘package:flutter_datetime_picker/src/datetime_picker_theme.dart’.
import ‘package:flutter_datetime_picker/src/datetime_picker_theme.dart’;
datetime_picker_theme.dart:1
^^^^^^^^^^^^^^^
/C:/Users/DL/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker-1.5.1/lib/flutter_datetime_picker.dart:199:31: Error: ‘DatePickerTheme’ is imported from both ‘package:flutter/src/material/date_picker_theme.dart’ and ‘package:flutter_datetime_picker/src/datetime_picker_theme.dart’.
this.theme = theme ?? DatePickerTheme(),
^^^^^^^^^^^^^^^
Failed to compile application.
this error happens after I update
2
Answers
Seem likes the new updated Flutter has it own material
datetime_picker_theme
& you also usedatetime_picker_theme
in packageflutter_datetime_picker
. You could use the alias for import package, check out: Does Dart have import alias?If your previous
datetime_picker_theme
belongs to packageflutter_datetime_picker
, you could make a alias for it, such as:And then use your
DatePickerTheme()
.problem: DatePickerTheme class conflict in 2 different pub package
possible solution:
example
`import ‘package:lib1/lib1.dart’;
import ‘package:lib2/lib2.dart’ as lib2;
// Uses Element from lib1.
Element element1 = Element();
// Uses Element from lib2.
lib2.Element element2 = lib2.Element();`