Flutter – Error: The language version override has to be the same in the library and its part(s)

I was update my Flutter SDK version from dev channel (1.14.5) to stable channel (2.0.1). My codes was works perfectly but now i get this error. I think the problem is at slide_countdown_clock but im not sure.

    lib/Screens/sets4_widget/Countdown.dart:7:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/clip_digit.dart';
     ^
lib/Screens/sets4_widget/Countdown.dart:8:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/digit.dart';
     ^
lib/Screens/sets4_widget/Countdown.dart:9:6: Error: The language version override has to be the same in the library and its part(s).
part 'package:slide_countdown_clock/slide_direction.dart';
     ^


FAILURE: Build failed with an exception.

* Where:
Script 'C:flutterpackagesflutter_toolsgradleflutter.gradle' line: 991

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:flutterbinflutter.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 13s
Exception: Gradle task assembleDebug failed with exit code 1
     ^

I also share the lines of code that the error pointed to me below.

part 'package:slide_countdown_clock/clip_digit.dart';
part 'package:slide_countdown_clock/digit.dart';
part 'package:slide_countdown_clock/slide_direction.dart';

those parts are give me error. I tried flutter clean > flutter upgrade > flutter pub upgrade but still no result. Can anyone please help?

Answer

slide_countdown_clock, this package does not support Null Safety and Flutter 2.0.1 is a version with null safety.

So, you can’t use it on Flutter version 2.0.1. Try to use another pub package that supports Null Safety.

You should not upgrade to Flutter version 2.0.1 until your existing project’s dependencies are not supporting Null Safety.

Leave a Reply

Your email address will not be published. Required fields are marked *