How to fix Expected an identifier, but got '.'. in Flutter

Viewed 93

The error with flutter viewport, when I try to run the app on android, even on chrome. I tried the following:

  • re-installing flutter
  • creating new projects
  • cloning an existing projects
  • run on web update android studio
  • user different versions of Gradle
  • upgrading java
  • flutter pub cache clean
  • removing the build folder

the exception:

/flutter/packages/flutter/lib/src/rendering/viewport.dart:1375:15: Error: Expected an identifier, but got '.'.
Try inserting an identifier before '.'.
              .hasthrow FlutterError.fromParts(<DiagnosticsNode>[
              ^
/flutter/packages/flutter/lib/src/rendering/viewport.dart:1375:16: Error: Expected ';' after this.
              .hasthrow FlutterError.fromParts(<DiagnosticsNode>[
               ^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script '/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1156
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Applications/Development/flutter/bin/flutter'' finished with non-zero exit value 1

Flutter Doctor as requested:

[✓] Flutter (Channel stable, 3.0.5, on macOS 13.0 22A5311f darwin-x64, locale en-US)
    • Flutter version 3.0.5 at /Applications/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 weeks ago), 2022-07-13 
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2
⣯
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/alina/Library/Android/sdk
    • Platform android-31, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3
[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      :hammer: https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      :hammer: https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.69.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0
[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.0 22A5311f darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.134
[✓] HTTP Host Availability
    • All required HTTP hosts are available
• No issues found!

[✓] Flutter (Channel stable, 3.0.5, on macOS 13.0 22A5311f darwin-x64, locale en-US)
    • Flutter version 3.0.5 at /Applications/Development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (3 weeks ago), 2022-07-13 
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2
⣯
Checking Android licenses is taking an unexpectedly long time...[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/alina/Library/Android/sdk
    • Platform android-31, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3
[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      :hammer: https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      :hammer: https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.69.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0
[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 13.0 22A5311f darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 103.0.5060.134
[✓] HTTP Host Availability
    • All required HTTP hosts are available
• No issues found!
0 Answers
Related