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

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

Related

ObjectBox Generator: Error: No named parameter with the name 'lazy'

I registered my ObjectBox Store as a LazySingleton with this method
setupLocatorAdditions() async {
stackedAdditionLocator.registerLazySingletonAsync<Store>(() => openStore());
}
Which worked fine. But after multiple rebuilds from the BuildRunner the ObjectBox Generator threw this error, regardless of whether I removed the singleton registration and reran it.
lib/objectbox.g.dart:1341:67: Error: No named parameter with the name 'lazy'.
weekDays: const fb.ListReader<int>(fb.Int8Reader(), lazy: false)
^^^^
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/objectbox-1.1.1/lib/flatbuffers/flat_buffers.dart:994:9: Context: Found this candidate, but the arguments don't match.
const ListReader(this._elementReader);
^^^^^^^^^^
lib/objectbox.g.dart:1343:68: Error: No named parameter with the name 'lazy'.
locations: const fb.ListReader<int>(fb.Int8Reader(), lazy: false)
^^^^
../../Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/objectbox-1.1.1/lib/flatbuffers/flat_buffers.dart:994:9: Context: Found this candidate, but the arguments don't match.
const ListReader(this._elementReader);
^^^^^^^^^^
2
FAILURE: Build failed with an exception.
That argument isn't part of the released objectbox-dart v1.1.1 (it was added by this commit 13 days ago while v1.1.1 was released 19 days ago).
Looks like you're using a mismatching generator? Can you check your pubspec.yaml if you're using a dependency override on objectbox_generator, e.g. from git? If you're using a dependency override you should stick to a specific commit and make sure you use it on both generator and objectbox library itself. If you don't need the dependency override, just remove it from your pubspec.yaml.
In both cases, run pub get after making the changes and pub run build_runner build.

How to fix Flutter build_runner error: Failed to precompile build_runner:build_runner:

I'm working on two Flutter projects, one of them has already been migrated to null safety and uses Flutter 2.0.5. The second project, the one that causes the issues, is not yet migrated to null safety and uses Flutter 1.22.6. Switching projects is done by just renaming the Flutter SDK folder.
Now the problem is that build_runner only works for Flutter 2.0.5. When calling flutter pub run build_runner build from inside the Flutter 1.22.6 project, it fails
with the following error messages:
Failed to precompile build_runner:build_runner:
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.1.0/lib/src/multi_headers.dart:97:8: Error: The method 'MultiHeaders.add' has fewer named arguments than those of overridden method 'HttpHeaders.add'.
void add(String name, Object value) {
^
org-dartlang-sdk:///sdk/lib/_http/http.dart:698:8: Context: This is the overridden method ('add').
void add(String name, Object value,
^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/http_multi_server-2.1.0/lib/src/multi_headers.dart:129:8: Error: The method 'MultiHeaders.set' has fewer named arguments than those of overridden method 'HttpHeaders.set'.
void set(String name, Object value) {
^
org-dartlang-sdk:///sdk/lib/_http/http.dart:707:8: Context: This is the overridden method ('set').
void set(String name, Object value,
^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.11.0/lib/src/entrypoint/runner.dart:23:31: Error: No named parameter with the name 'usageLineLength'.
final argParser = ArgParser(usageLineLength: lineLength);
^^^^^^^^^^^^^^^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.4/lib/src/arg_parser.dart:43:11: Context: Found this candidate, but the arguments don't match.
factory ArgParser({bool allowTrailingOptions: true}) =>
^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.11.0/bin/src/commands/clean.dart:18:31: Error: No named parameter with the name 'usageLineLength'.
final argParser = ArgParser(usageLineLength: lineLength);
^^^^^^^^^^^^^^^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.4/lib/src/arg_parser.dart:43:11: Context: Found this candidate, but the arguments don't match.
factory ArgParser({bool allowTrailingOptions: true}) =>
^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-1.11.0/bin/src/commands/generate_build_script.dart:18:31: Error: No named parameter with the name 'usageLineLength'.
final argParser = ArgParser(usageLineLength: lineLength);
^^^^^^^^^^^^^^^
../../../Flutter%20SDK/flutter/.pub-cache/hosted/pub.dartlang.org/args-1.4.4/lib/src/arg_parser.dart:43:11: Context: Found this candidate, but the arguments don't match.
factory ArgParser({bool allowTrailingOptions: true}) =>
Oddly enough all of these errors are outside the project.
Calling flutter clean and flutter pub cache repair has no effect. So the question is, what needs to be done to get build_runner working on (the now obsolete) Flutter version 1.22.6?
Your advise is very much welcome, Thank you!
Because a required third party library prevented migrating to null safety, the only solution was to eliminate build_runner by switching from generated json to hand written one.
More a workaround than a solution, but it sufficed.

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.

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

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

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).