Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Error: Could not resolve the package 'characters' in 'package:characters/characters.dart'.] after enabling web #62674

Closed
gamepro110 opened this issue Jul 31, 2020 · 16 comments

Comments

@gamepro110
Copy link

new project

import 'package:flutter/material.dart';

void main() {
  runApp(TodoAppTest());
}

class TodoAppTest extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'todo tutorial',
      home: TodoList(),
    );
  }
}

class TodoList extends StatefulWidget {
  @override
  _TodoListState createState() => _TodoListState();
}

class _TodoListState extends State<TodoList> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Todo Test"),
      ),
    );
  }
}

follow steps on this link for the SETUP only.
trying to build for android on vm.

Expected results:
blank empty app with only an appbar

Actual results:
errors in terminal...

Logs
flutter analyze
Analyzing flutter_todo_test...
No issues found! (ran in 10.2s)
flutter doctor -v
[√] Flutter (Channel beta, 1.20.0-7.3.pre, on Microsoft Windows [Version 10.0.19041.388], locale en-US)
    • Flutter version 1.20.0-7.3.pre at D:\SDK`s\flutter
    • Framework revision e606910f28 (3 days ago), 2020-07-28 16:06:37 -0700
    • Engine revision ac95267aef
    • Dart version 2.9.0 (build 2.9.0-21.10.beta)


[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Users\NB-K02\AppData\Local\Android\sdk
    • Platform android-29, build-tools 29.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 47.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.47.3)
    • VS Code at C:\Users\NB-K02\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.13.0

[√] Connected device (3 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
    • Web Server (web)                   • web-server    • web-javascript • Flutter Tools
    • Chrome (web)                       • chrome        • web-javascript • Google Chrome 84.0.4147.105

• No issues found!

@darshankawar
Copy link
Member

Hi @gamepro110,
Can you provide the logs you see when you get this error ?
Can you try flutter pub cache repair or flutter clean and then flutter run to see if it works for you ?
Thanks.

@darshankawar darshankawar added in triage Presently being triaged by the triage team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds labels Aug 3, 2020
@gamepro110
Copy link
Author

this is what i get when i tried to run it before flutter pub cache repair
Launching lib\main.dart on Chrome in debug mode... Error: Could not resolve the package 'characters' in 'package:characters/characters.dart'. /D:/SDK%60s/flutter/packages/flutter/lib/src/material/text_field.dart:9:8: Error: Not found: 'package:characters/characters.dart' import 'package:characters/characters.dart'; ^ /D:/SDK%60s/flutter/packages/flutter/lib/widgets.dart:18:1: Error: Not found: 'package:characters/characters.dart' export 'package:characters/characters.dart'; ^ /D:/SDK%60s/flutter/packages/flutter/lib/src/rendering/editable.dart:10:8: Error: Not found: 'package:characters/characters.dart' import 'package:characters/characters.dart'; ^ /D:/SDK%60s/flutter/packages/flutter/lib/src/services/text_formatter.dart:9:8: Error: Not found: 'package:characters/characters.dart' import 'package:characters/characters.dart'; ^ /D:/SDK%60s/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; ^^^^^^^^^^ /D:/SDK%60s/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; ^^^^^^^^^^ /D:/SDK%60s/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), ^^^^^^^^^^ /D:/SDK%60s/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); ^^^^^^^^^^ /D:/SDK%60s/flutter/packages/flutter/lib/src/rendering/editable.dart:567:11: Error: 'Characters' isn't a type. final Characters remaining = string.characters.skipWhile((String currentString) { ^^^^^^^^^^ /D:/SDK%60s/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) { ^^^^^^^^^^ /D:/SDK%60s/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) { ^^^^^^^^^^ /D:/SDK%60s/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))) { ^^^^^^^^^^ /D:/SDK%60s/flutter/packages/flutter/lib/src/services/text_formatter.dart:355:11: Error: 'CharacterRange' isn't a type. final CharacterRange iterator = CharacterRange(value.text); ^^^^^^^^^^^^^^ /D:/SDK%60s/flutter/packages/flutter/lib/src/services/text_formatter.dart:355:37: Error: Method not found: 'CharacterRange'. final CharacterRange iterator = CharacterRange(value.text); ^^^^^^^^^^^^^^ /D:/SDK%60s/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) { ^^^^^^^^^^ /D:/SDK%60s/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) { ^^^^^^^^^^ /D:/SDK%60s/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) {

below is the result after running flutter clean and flutter run
flutter run Running "flutter pub get" in flutter_todo_test... 1.0s Using hardware rendering with device Android SDK built for x86. If you notice graphics artifacts, consider enabling software rendering with "--enable-software-rendering". Launching lib\main.dart on Android SDK built for x86 in debug mode... Running Gradle task 'assembleDebug'... Running Gradle task 'assembleDebug'... Done 27.7s √ Built build\app\outputs\flutter-apk\app-debug.apk. Installing build\app\outputs\flutter-apk\app.apk... 3.3s Waiting for Android SDK built for x86 to report its views... 8ms D/EGL_emulation(11001): eglMakeCurrent: 0xddaf2300: ver 3 0 (tinfo 0xddb91600) I/OpenGLRenderer(11001): Davey! duration=1136ms; Flags=1, IntendedVsync=27874272076054, Vsync=27874272076054, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=27874275486500, AnimationStart=27874275732700, PerformTraversalsStart=27874276379800, DrawStart=27875052265300, SyncQueued=27875054397700, SyncStart=27875055367300, IssueDrawCommandsStart=27875056306900, SwapBuffers=27875268882800, FrameCompleted=27875409907600, DequeueBufferDuration=50434000, QueueBufferDuration=1354000, I/Choreographer(11001): Skipped 67 frames! The application may be doing too much work on its main thread. D/EGL_emulation(11001): eglMakeCurrent: 0xddaf2a80: ver 3 0 (tinfo 0xd5ab2430) Syncing files to device Android SDK built for x86... 623ms

as a side note...
this is all that the app contains seeing i saw it complaining about doing too much
`
import 'package:flutter/material.dart';

void main() {
runApp(TodoAppTest());
}

class TodoAppTest extends StatelessWidget {
@OverRide
Widget build(BuildContext context) {
return MaterialApp(
title: 'todo tutorial',
home: TodoList(),
);
}
}

class TodoList extends StatefulWidget {
@OverRide
_TodoListState createState() => _TodoListState();
}

class _TodoListState extends State {
@OverRide
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Todo Test"),
),
);
}
}
`
please tell me if u need anything else

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 3, 2020
@gamepro110
Copy link
Author

i tried to debug it in vs code and it works again (forgot to check before sending the reply)
thanks for helping me

@darshankawar darshankawar removed the in triage Presently being triaged by the triage team label Aug 5, 2020
@pakindessama
Copy link

Hi @gamepro110,
Can you provide the logs you see when you get this error ?
Can you try flutter pub cache repair or flutter clean and then flutter run to see if it works for you ?
Thanks.

It worked for me.

@Nish1312
Copy link

Use

  1. flutter clean
  2. flutter run
    This resolved the problem for me...

@aziz60
Copy link

aziz60 commented Aug 14, 2020

flutter clean and run again

@cbritez
Copy link

cbritez commented Aug 14, 2020

Thank you!! It worked

@imhazard17
Copy link

thanks it worked for me too!

@artob
Copy link

artob commented Aug 17, 2020

Related issue: #59645

@rahuls52
Copy link

i am facing the same issue i try this command
----- flutter pub cache repair or flutter clean and then flutter run
it is works for me .

Thanks.

@amuchand47
Copy link

thnx a lot! it works for me.

@VeyVovv
Copy link

VeyVovv commented Aug 31, 2020

the reason was because of installing SDK upgrades.
now, it works. thanks.

@chamodSamajith
Copy link

Hi @gamepro110,
Can you provide the logs you see when you get this error ?
Can you try flutter pub cache repair or flutter clean and then flutter run to see if it works for you ?
Thanks.

This worked for me!!thnx

@silveton
Copy link

Delete files

.flutter-plugins
.flutter-plugins-dependencies
.pubspec.lock
.packages

Delete path
.dart_tool

flutter pub cache repair or flutter clean and flutter run

This worked for me.

@WaimaniMaduranga
Copy link

yes thanks that also worked for me

@github-actions
Copy link

github-actions bot commented Aug 9, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests