After upgrading flutter version from v1.12.13+hotfix.8 to 1.17.0 getting such error - flutter

Compiler message:
../../../Public/FlutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.12/lib/src/date_picker_theme.dart:39:9: Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments.
const DateTimePickerTheme({
^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.

If you are using flutter_cupertino_date_picker, you may be will need to update it, This is working with me:
flutter_cupertino_date_picker: ^1.0.26

Related

Error: Couldn't find constructor 'TypeMatcher'. .ancestorStateOfType(const TypeMatcher<AnimatedCircularChartState>());

i even done that but errors are still there. i tried to downgrade the flutter version sdk to that project but didn't find the specific version and the ones i found are not helping.
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_circular_chart-0.1.0/lib/src/animated_circular_chart.dart:122:36: Error: Couldn't find constructor 'TypeMatcher'.
.ancestorStateOfType(const TypeMatcher\<AnimatedCircularChartState\>());
^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_circular_chart-0.1.0/lib/src/animated_circular_chart.dart:122:10: Error: The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.
- 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('/C:/src/flutter/packages/flutter/lib/src/widgets/framework.dart').
Try correcting the name to the name of an existing method, or defining a method named 'ancestorStateOfType'.
.ancestorStateOfType(const TypeMatcher\<AnimatedCircularChartState\>());
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_circular_chart-0.1.0/lib/src/animated_circular_chart.dart:221:60: Error: The getter 'body2' isn't defined for the class 'TextTheme'.
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/text_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'body2'.
widget.labelStyle ?? Theme.of(context).textTheme.body2;
^^^^^
Failed to compile application.
So i downloaded this flutter project from github that was 3 years old so it was deprecated version, i fix the deprecated version error by following the documentation. now that error is fixed but after that i'm getting these errors above. i have tried so many things like pub upgrade, pub outdated and most of the commands like this but the error are still there. I somewhere read to add override dependencies: "dependency_overrides:
charts_flutter:
git:
url: https://github.com/google/charts
path: charts_flutter"

Failed to precompile build_runner:build_runner:

I created a new project, added dependencies
when I launch it
flutter pub run build_runner build
I get:
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:1600:40: Error: Getter not found: 'topLevelVariable'.
return kinds.contains(TargetKind.topLevelVariable);
^^^^^^^^^^^^^^^^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Getter not found: 'topLevelVariable'.
case TargetKind.topLevelVariable:
^^^^^^^^^^^^^^^^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2024:23: Error: Type 'dynamic' of the case expression is not a subtype of type 'TargetKind' of this switch
expression.
- 'TargetKind' is from 'package:meta/meta_meta.dart' ('/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/meta-1.3.0/lib/meta_meta.dart').
case TargetKind.topLevelVariable:
^
/C:/Users/Michael/AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-1.6.0/lib/src/error/best_practices_verifier.dart:2001:13: Context: The switch expression is here.
switch (this) {
^
pub finished with exit code 1
I've read everything on stackoverflow, but I haven't found a solution.
Any idea?
Specify the analyzer version
analyzer: 1.5.0
Warning: do not up to the latest version, because it depends on meta package as is flutter_test - where you can't specify the version

Error run current project after flutter upgrade v3.13

I am getting the following error run project in my vscode debug console after flutter upgrade v3.13:
Invalid depfile: C:\Users\DIMAS\FlutterCode\skip\.dart_tool\flutter_build\35269fa8986c9ee7a9c97697217003ec\kernel_snapshot.d
Invalid depfile: C:\Users\DIMAS\FlutterCode\skip\.dart_tool\flutter_build\35269fa8986c9ee7a9c97697217003ec\kernel_snapshot.d
Error: Could not resolve the package 'characters' in 'package:characters/characters.dart'.
/C:/src/flutter/packages/flutter/lib/src/material/text_field.dart:9:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
^
/C:/src/flutter/packages/flutter/lib/widgets.dart:18:1: Error: Not found: 'package:characters/characters.dart'
export 'package:characters/characters.dart';
^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:10:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:9:8: Error: Not found: 'package:characters/characters.dart'
import 'package:characters/characters.dart';
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:26: Error: Type 'DiagnosticableMixin' not found.
class PictureStream with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:44: Error: Type 'DiagnosticableMixin' not found.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:88:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
class PictureStream with DiagnosticableMixin {
^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:192:16: Error: The type 'DiagnosticableMixin' can't be mixed in.
abstract class PictureStreamCompleter with DiagnosticableMixin {
^
/C:/src/flutter/packages/flutter/lib/src/material/text_field.dart:822:61: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
int get _currentLength => _effectiveController.value.text.characters.length;
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/material/text_field.dart:824:118: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
bool get _hasIntrinsicError => widget.maxLength != null && widget.maxLength > 0 && _effectiveController.value.text.characters.length > widget.maxLength;
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:244:64: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
assert(obscuringCharacter != null && obscuringCharacter.characters.length == 1),
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:361:35: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
assert(value != null && value.characters.length == 1);
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:567:11: Error: 'Characters' isn't a type.
final Characters remaining = string.characters.skipWhile((String currentString) {
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:567:41: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
final Characters remaining = string.characters.skipWhile((String currentString) {
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:600:47: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
for (final String currentString in string.characters) {
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/rendering/editable.dart:602:40: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
!_isWhitespace(currentString.characters.first.toString().codeUnitAt(0))) {
^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:167:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(properties);
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:171:30: Error: The method 'toStringShort' isn't defined for the class 'PictureStreamCompleter'.
- 'PictureStreamCompleter' is from 'package:flutter_svg/src/picture_stream.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart').
Try correcting the name to the name of an existing method, or defining a method named 'toStringShort'.
ifPresent: _completer?.toStringShort(),
^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.17.4/lib/src/picture_stream.dart:266:11: Error: Superclass has no method named 'debugFillProperties'.
super.debugFillProperties(description);
^^^^^^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:355:11: Error: 'CharacterRange' isn't a type.
final CharacterRange iterator = CharacterRange(value.text);
^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:355:37: Error: Method not found: 'CharacterRange'.
final CharacterRange iterator = CharacterRange(value.text);
^^^^^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:356:20: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
if (value.text.characters.length > maxLength) {
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:375:61: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
if (maxLength != null && maxLength > 0 && newValue.text.characters.length > maxLength) {
^^^^^^^^^^
/C:/src/flutter/packages/flutter/lib/src/services/text_formatter.dart:378:25: Error: The getter 'characters' isn't defined for the class 'String'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'characters'.
if (oldValue.text.characters.length == maxLength) {
^^^^^^^^^^
Unhandled exception:
FileSystemException(uri=org-dartlang-untransla
table-uri:package%3Acharacters%2Fcharacters.dart; message=StandardFileSystem only supports file:* and data:* URIs)
[38;5;248m#0 StandardFileSystem.entityForUri (package:front_end/src/api_prototype/standard_file_system.dart:33:7)[39;49m
[38;5;248m#1 asFileUri (package:vm/kernel_front_end.dart:659:37)[39;49m
[38;5;248m#2 writeDepfile (package:vm/kernel_front_end.dart:853:21)[39;49m
<asynchronous suspen
sion>
[38;5;248m#3 FrontendCompiler.compile (package:frontend_server/frontend_server.dart:574:15)[39;49m
[38;5;244m<asynchronous suspension>[39;49m
#4 _FlutterFrontendCompiler.compile (packa
ge:flutter_frontend_server/server.dart:43:22)
[38;5;248m#5 starter (package:flutter_frontend_server/server.dart:182:27)[39;49m
#6 main (file:///C:/b/s/w/ir/cache/builder/src/flut
ter/flutter_frontend_server/bin/starter.dart:9:30)
[38;5;244m#7 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)[39;49m
#8 _RawReceivePortImpl
._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
FAILURE: Build failed with an exception.
Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 896
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.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 57s
Exception: Gradle task assembleDebug failed with exit code 1
its seems missing character.dart and some gradle stuff, but i couldn't find exact problem and answer for now on google,
But if i make and run a new project it doesn't have any error, herewith my pubspec.yaml (i've compared old & new project pubspec.yaml there is no significant different exept for additional package):
It looks like you’re missing characters package in your pubspec.yaml.
Make sure it is there and your pubspec is formatted properly. And run flutter pub get again.
If this fails, you should run flutter pub cache repair
Had the same issue.
In pubspec.yaml just execute flutter pub get and flutter pub upgrade.
Then in the root directory terminal execute flutter clean and it will run without problems.
I have had similar issue on my flutter application after I updated the flutter SDK.
What solved my issue were to do the following.
Open a terminal (CMD) navigate to your flutter project, where the pubspec.yaml is. Run the following commands:
Solution
flutter pub get
flutter pub upgrade
After that if you still have issues you can run the flutter pub cache repair, however the
flutter clean
did the trick for me and fixed the issue.
I restarted both visual studio and the AVD virtual device, to be sure
to have a fresh restart.
What tools and software I use:
Visual Studio Code 1.47.3
Android Studio 4.0.1 (Android Virtual Device)
Flutter 1.20.1 (Release date 6.8.2020)
Dart 2.9.0
after refresh the flutter pub get, i've had error SVG problem and i update flutter_svg: ^0.17.4 to flutter_svg: ^0.18.0 it solved SVG problem,
I've ran into this issue a couple times after running flutter upgrade on a new flutter release. In my case, the solution had nothing to do with the error. Just outdated dependencies.
I first did flutter clean (IntelliJ/Android Studio from the tools>Flutter>Flutter clean.)
Updated my pubspec.yaml dependencies to their latest version and ran flutter pub upgrade
Finished! Now you should be able to build and run
try in terminal
$ flutter clean
after
$ flutter doctor
that should solve your issue
I faced the same issue, after deleting the .dart_tool directory/folder and running the application again, the problem solved
Yes! Many people are getting this as the kotlin version and build SDK versions are not in line with each other. just do as follow. one can clean this by only flutter pub upgrade after flutter pub cache repair but once for all I will suggest to follow as below.
flutter clean
flutter pub get
flutter pub cache repair
flutter pub upgrade
done! Happy Coding.

Facing error after flutter 1.17 update. Couldn't figure out was it the problem due to update or not

Compiler message:
/C:/src/flutter/packages/flutter/lib/src/widgets/actions.dart:32:9:
Error: The superclass, 'Diagnosticable', has no unnamed constructor
that takes no arguments. const Intent(this.key) : assert(key !=
null);
^^^^^^ /C:/src/flutter/packages/flutter/lib/src/widgets/actions.dart:80:9:
Error: The superclass, 'Diagnosticable', has no unnamed constructor
that takes no arguments. const Action(this.intentKey) :
assert(intentKey != null);
^^^^^^ /C:/src/flutter/packages/flutter/lib/src/widgets/actions.dart:145:9:
Error: The superclass, 'Diagnosticable', has no unnamed constructor
that takes no arguments. const ActionDispatcher();
^^^^^^^^^^^^^^^^ Target kernel_snapshot failed: Exception: Errors during snapshot creation: null build failed.
Note: Facing this problem for a newly created app also.
Reinstalled flutter resolved the issue. I think the problem was with the framework revision due to improper update of flutter.
Note: Answer provided by OP on comment section.
flutter pub upgrade --major-versions
Use this Command in your terminal to solve this issue

Internal compiler error message during Flutter hot reload:

I get the following error during Flutter hot reload
Compiler message:
org-dartlang-debug:synthetic_debug_expression:1:1: Error: Getter not found: 'response'.
^^^^^^^^^^^^
org-dartlang-debug:synthetic_debug_expression:1:1: Error: The getter 'using' isn't defined for the class 'MyHomePageState'.
- 'MyHomePageState' is from 'package:SampleApp/main.dart' ('lib/main.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'using'.
using
This is a known bug which should be fixed in the next release. The only workaround is to run flutter clean. (Using Android Studios Tools -> Flutter -> Flutter Clean should also work).