Faheem Ahmad
Faheem Ahmad

Reputation: 173

I am getting this error when i ran a flutter project from github... i tried everything

I am getting this error when i ran a flutter project from github... i tried everything. i tried many command but no luck

Try correcting the name to the name of an existing getter, or defining a getter or field named 'headline'.
        theme.primaryTextTheme.headline;
                               ^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:338:45: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/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'.
    TextStyle sideStyle = widget.textTheme?.body1 ??
                                            ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:339:32: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/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'.
        appBarTheme.textTheme?.body1 ??
                               ^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:340:32: Error: The getter 'body1' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/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'.
        theme.primaryTextTheme.body1;
Launching lib\main.dart on Edge in debug mode...
lib\main.dart:1
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:322:57: Error: No named parameter with the name 'nullOk'.
    final ScaffoldState scaffold = Scaffold.of(context, nullOk: true);
                                                        ^^^^^^
/C:/flutter/packages/flutter/lib/src/material/scaffold.dart:1769:24: Context: Found this candidate, but the arguments don't match.
  static ScaffoldState of(BuildContext context) {
                       ^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:335:47: Error: The getter 'headline' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/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 'headline'.

    TextStyle centerStyle = widget.textTheme?.headline ??
                                              ^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:336:32: Error: The getter 'headline' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/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 'headline'.
        appBarTheme.textTheme?.headline ??
                               ^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/velocity_x-0.3.4/lib/src/flutter/appbar.dart:337:32: Error: The getter 'headline' isn't defined for the class 'TextTheme'.
 - 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/flutter/packages/flutter/lib/src/material/text_theme.dart').
                               ^^^^^

Failed to compile app. Exited (sigterm)

Upvotes: 1

Views: 4620

Answers (1)

h8moss
h8moss

Reputation: 5030

You are attempting to use code written for an older version of flutter, that is the problem, you need to either downgrade your SDK or update the code.

Updating the code should be simple enough, most changes are very intuitive and IntelliSense can autocomplete what you don't know, however it seems like the original code used the getflutter package, which has since been discontinued and now is getWidget, I've never used neither, but the migration shouldn't be too hard.

If you are interested in updating the code here are the main changes I can see:

The getter 'body1' isn't defined for the class 'TextTheme'.

just change body1 to bodyText1

The getter 'headline' isn't defined for the class 'TextTheme'.

just change headline to headline1

And if what you want to do is downgrade the SDK, which might be the better option, simply download an older version from here

Upvotes: 5

Related Questions