Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error run current project after flutter upgrade v3.13

Tags:

flutter

dart

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): enter image description here

like image 919
Dhimas Putera Avatar asked Aug 06 '20 09:08

Dhimas Putera


2 Answers

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

like image 76
lenz Avatar answered Sep 22 '22 14:09

lenz


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.

like image 40
viniciusbaca Avatar answered Sep 20 '22 14:09

viniciusbaca