salomepx
salomepx

Reputation: 83

Error: The getter 'bodyText2' isn't defined for the class 'TextTheme'

I am using latest version of flutter, with latest version of Xcode, with latest version of android studio. I also have charts_flutter: ^0.12.0 but I am getting the error :

Launching lib/main.dart on iPhone 15 Pro Max in debug mode...
Xcode build done.                                            3,9s
Failed to build iOS app
Error (Xcode): ../.pub-cache/hosted/pub.dev/charts_flutter-0.12.0/lib/src/behaviors/legend/legend_entry_layout.dart:134:45: 
Error: The getter 'bodyText2' isn't defined for the class 'TextTheme'.

Could not build the application for the simulator.
Error launching application on iPhone 15 Pro Max.

I tried flutter upgrade, flutter doctor, but everything is right and up to date. I do not understand why I have an error, and therefore do not know how to solve it after many stack overflow posts.

Upvotes: 2

Views: 4092

Answers (3)

Jyothika Dhanekula
Jyothika Dhanekula

Reputation: 1

You can replace your charts_flutter with charts_flutter_new recent version.
Navigate to AppData\Local\Pub\Cache\hosted\pub.dev\charts_flutter_new-0.12.0\lib\src\behaviors\legend\legend_entry_layout and find bodyText2 with bodyMedium. Issue should be solved.
However charts_flutter_new also doesn't have any update since 2 years so eventually it will discontinued as well, so fl_chart is current better option to replace charts_flutter.

Upvotes: 0

Andrey Molochko
Andrey Molochko

Reputation: 768

You can use Use 3.0.0-beta.2 for fix

Upvotes: 0

Munsif Ali
Munsif Ali

Reputation: 6141

The error you are getting is due to using of an old package. the last version of that package was released 2 years ago and in 2 years flutter changed very rapidly and the text theme property bodyText2 has been removed in the latest version of the flutter which you can now use bodyMedium in palce of bodyText2 and as this error is in the package either change the package and use a new one. or open the file which is causing the issue and change the bodyText2 property to bodyMedium. you can read about other removed text theme properties here

Upvotes: 5

Related Questions