I could not build my project after upgrading my flutter. I upgraded the flutter from 3.0.1 to 3.10.0
The debug console is showing:
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/form_builder_extra_fields-8.3.0/lib/src/fields/form_builder_cupertino_date_time_picker.dart:6:1: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
import 'package:flutter_datetime_picker_bdaya/flutter_datetime_picker_bdaya.dart';
flutter_datetime_picker_bdaya.dart:1
^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker_bdaya-2.0.0/lib/flutter_datetime_picker_bdaya.dart:7:1: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
import 'src/datetime_picker_theme.dart';
^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker_bdaya-2.0.0/lib/flutter_datetime_picker_bdaya.dart:200:31: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
this.theme = theme ?? DatePickerTheme(),
^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_chips_input-2.0.0/lib/src/chips_input.dart:87:7: Error: The non-abstract class 'ChipsInputState' is missing implementations for these members:
- TextInputClient.didChangeInputControl
- TextInputClient.insertContent
- TextInputClient.performSelector
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class ChipsInputState<T> extends State<ChipsInput<T>>
^^^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1158:8: Context: 'TextInputClient.didChangeInputControl' is defined here.
void didChangeInputControl(TextInputControl? oldControl, TextInputControl? newControl) {}
^^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1117:8: Context: 'TextInputClient.insertContent' is defined here.
void insertContent(KeyboardInsertedContent content) {}
^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1179:8: Context: 'TextInputClient.performSelector' is defined here.
void performSelector(String selectorName) {}
^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
* Where:
Script 'D:Flutterflutterpackagesflutter_toolsgradleflutter.gradle' line: 1159
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:Flutterflutterbinflutter.bat'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 6s
Exception: Gradle task assembleDebug failed with exit code 1
My packages imported are:
cupertino_icons: ^1.0.2
firebase_core_platform_interface: ^4.8.0
firebase_core: ^2.13.0
firebase_storage: ^11.2.1
file_picker: ^5.2.6
datetime_picker_formfield:
firebase_messaging: ^14.6.1
overlay_support: ^2.0.1
cloud_firestore: ^4.7.1
firebase_auth: ^4.6.1
flutter_facebook_auth:
intl: ^0.17.0
csc_picker:
google_sign_in:
image_picker: ^0.8.5+3
get:
google_maps_flutter: ^2.2.0
flutter_native_splash: ^1.2.0
geolocator:
flutter_map:
flutter_map_marker_cluster:
http:
geocoding: ^2.1.0
flutter_polyline_points: ^1.0.0
map_location_picker: ^1.1.0
My flutter doctor
- [√] Flutter (Channel stable, 3.10.0, on Microsoft Windows [Version
10.0.19044.2965], locale en-US) - [√] Windows Version (Installed version of Windows is version 10 or higher)
- [√] Android toolchain – develop for Android devices (Android SDK version 33.0.0-rc2)
- [√] Chrome – develop for the web
- [√] Visual Studio – develop for Windows
(Visual Studio Community 2022 17.0.0) - [√] Android Studio (version 2021.2)
- [√] VS Code (version 1.78.2)
- [√] Connected device (4 available)
- [√] Network resources
I have tried cleaning project, upgrading pub packages and flutter pub cache repair but it is still the same. Any other solutions I can use?
2
Answers
Sorry, I have solved it by using flutter pub upgrade --major-versions and removing some packages, so that it gets
These packages are no longer being depended on: - flutter_chips_input 2.0.0 - flutter_datetime_picker_bdaya 2.0.0 - flutter_touch_spin 2.0.0 - google_maps_webservice 0.0.20-nullsafety.5
Please avoid using screenshot and copy-paste the error into the question instead.
In your
ChipsInput
widget you used 2 imports that conflict with each other. It is conflicting where you callthis.theme = theme ?? DatePickerTheme()
because it doesn’t know which import to use since they have the same name.You need to either remove
import 'package:flutter/src/material/date_picker_theme.dart'
or
import 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'
Alternatively you can try to rename 1 of the imports using
as
like this: