5

My flutter application is not able to run on 2.5.0-5.3.pre beta version. after then I searched for it then need to upgrade my flutter sdk so have upgraded to latest beta version 2.6.0-5.2.pre but still getting errors. the errors with place_picker-0.9.19-nullsafety plugin. and not able to resolve it.

ERRORS LOG:

../../../../Workspace/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/rich_suggestion.dart:35:89: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../../Workspace/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 'body1'.
      TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),
                                                                                        ^^^^^
../../../../Workspace/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../../../Workspace/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 'body1'.
          Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),
                                                                ^^^^^


FAILURE: Build failed with an exception.

* Where:
Script '/Users/brightroots/Workspace/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1005

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/brightroots/Workspace/flutter/bin/flutter'' 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 31s

ERRORS:

enter image description here

MY CURRENT FUTTER VERSION:

Flutter 2.6.0-5.2.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 400608f101 (8 days ago) • 2021-09-15 15:50:26 -0700
Engine • revision 1d521d89d8
Tools • Dart 2.15.0 (build 2.15.0-82.2.beta)
Shruti Ramnandan Sharma
  • 3,244
  • 9
  • 33
  • 67

4 Answers4

2

I was dealing with this error. In my case, it was because there was a dependency that was not compatible with flutter 2.5. I tried many solutions. But only this worked for me.

First add this to your pubspec.yaml as described on this link.

If you have an error saying: remote end hung up unexpectedly while git cloning,

then run this git commands.

This solved my problem.

ouflak
  • 2,408
  • 10
  • 40
  • 47
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/30222535) – Robert Oct 31 '21 at 20:21
0

The error thrown on the logs seems to be thrown by the plugin that you're using: place_picker-0.9.19-nullsafety. The logs indicate that the issue comes from Theme.of(context).textTheme.body1

Checking the Flutter docs, body1 on TextTheme is defined as bodyText1. You might want to consider updating how body1 is being called in TextTheme. Otherwise, you can track this issue ticket filed on GitHub related to this issue.

Omatt
  • 5,027
  • 2
  • 25
  • 83
0

Edit the lines in the dart package like below and it will work. Of course the author should do this, but you can edit it yourself as well :)

rich_suggestion.dart

Original: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),

New: TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.bodyText1!.color)),

search_input.dart

Original: Icon(Icons.search, color: Theme.of(context).textTheme.body1!.color),

New: Icon(Icons.search, color: Theme.of(context).textTheme.bodyText1!.color),

image

0

Add them in dependencies and remove body1 from bodyText1

charts_flutter:
    git:
      url: git://github.com/google/charts.git
      path: charts_flutter
Tyler2P
  • 2,182
  • 12
  • 17
  • 28