Dran Leynard Gamoso
Dran Leynard Gamoso

Reputation: 1

After I update the flutter there's an import error in flutter

/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

Upvotes: 0

Views: 728

Answers (2)

Medwin Correo
Medwin Correo

Reputation: 1

problem: DatePickerTheme class conflict in 2 different pub package

possible solution:

  1. try to check the changes from pub packages, and figure out the broken changes,
  2. theres 2 class DatePickerTheme exist in 2 different packages, try to import them "as" similar to this dart import

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();

Upvotes: 0

Nguyen family
Nguyen family

Reputation: 1048

Seem likes the new updated Flutter has it own material datetime_picker_theme & you also use datetime_picker_theme in package flutter_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 package flutter_datetime_picker, you could make a alias for it, such as:

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

And then use your DatePickerTheme().

Upvotes: 0

Related Questions