skip to Main Content

When we run our flutter app we have an error that stop all, and the error don’t say us where it comes from :

Error: The getter 'title' isn't defined for the class 'TextTheme'.
vertical_stack_header_dialog.dart:61
- 'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('../../flutter/packages/flutter/lib/src/material/text_theme.dart').
text_theme.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'title'.style: Theme.of(context).textTheme.title,

2

Answers


    1. Make sure you have the latest version of Flutter and Dart SDK installed.
    2. Check if you have imported the necessary packages correctly, especially the ‘material.dart’ package.
    3. Verify that you are using the correct syntax when accessing the ‘title’ getter from the ‘TextTheme’ class. Double-check the spelling and capitalization.
    4. If the issue persists, try running ‘flutter clean’ to clear any cached build artifacts and then rebuild your app.
    5. If none of the above steps work, consider checking for any updates or bug fixes related to the package or library you are using that may address this issue.

    Please note that without seeing the specific code causing the error, it is difficult to provide an exact solution.

    Login or Signup to reply.
  1. The title field on TextTheme is removed in version 2.2. The replacement for it is headline6.

    You need to replace

    Theme.of(context).textTheme.title
    

    with

    Theme.of(context).textTheme.headline6
    

    This is the full list of the old and new APIs:

    OLD         NEW
    
    display4    headline1
    display3    headline2
    display2    headline3
    display1    headline4
    headline    headline5
    title       headline6
    subhead     subtitle1
    body2       bodyText1
    body1       bodyText2
    subtitle    subtitle2
    

    See also:

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search