Flutter Error after upgrade to latest version - flutter

recently updated my flutter to v2.5.3 and I'm getting the following error :
371:41: Error: The getter 'subhead' isn't defined for the class 'TextTheme'.
'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/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 'subhead'.
? Theme.of(context).textTheme.subhead
^^^^^^^
../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/searchable_dropdown-1.1.3/lib/searchable_dropdown.dart:374:16: Error: The getter 'subhead' isn't defined for the class 'TextTheme'.
'TextTheme' is from 'package:flutter/src/material/text_theme.dart' ('/C:/src/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 'subhead'.
.subhead
^^^^^^^

The error is somewhat self explanatory: The subhead property no longer exists in newer versions of the TextTheme, as per the 2018 Material Design guidelines.
If I'm not mistaken you should instead use subtitle1 as a closest replacement, but feel free to take a look at the Flutter documentation to find out which property to use instead.
See also this other SO question that also uses subhead:
How to use Flutter AppTheme TextTheme without overriding automatic text color

Related

Try correcting the name to the name of an existing getter

Error: The getter 'name' isn't defined for the class 'AVAudioSessionCategory'.
'AVAudioSessionCategory' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart'
('/D:/flutter_windows_2.5.3-stable/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
'category': category.name,
^^^^
/D:/flutter_windows_2.5.3-stable/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart:243:39:
Error: The getter 'name' isn't defined for the class 'AVAudioSessionOptions'.
'AVAudioSessionOptions' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart'
('/D:/flutter_windows_2.5.3-stable/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
'options': options.map((e) => e.name).toList(),
Could be 2 possible issues causing it to not find the getter name.. but here are some possible troubleshoot solutions
You changed or wrongly spelt the packagename or name of your project in pubsec.yaml.. And forgot to change the individual files to that new name. (So do that correction)
You wrote the code for an older version of flutter, and later upgraded flutter causing a mismatch,
If that's what you did, you need to downgrade your flutter SDK.. If you are in a hurry to meet a deadline, That will be a faster solution in this case, than updating the code line by line if its huge

how to solve flutter audio player getter name error

trying to follow a flutter tutorial and its packages documentation but i have no idea why it isnt working. to be precise its the audio players package. and when i run it i get this error message
/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart:242:28: Error: The getter 'name' isn't defined for the class 'AVAudioSessionCategory'.
- 'AVAudioSessionCategory' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart' ('/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
'category': category.name,
^^^^
/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart:243:39: Error: The getter 'name' isn't defined for the class 'AVAudioSessionOptions'.
- 'AVAudioSessionOptions' is from 'package:audioplayers_platform_interface/api/audio_context_config.dart' ('/D:/flutter/.pub-cache/hosted/pub.dartlang.org/audioplayers_platform_interface-1.0.0/lib/api/audio_context_config.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
'options': options.map((e) => e.name).toList(),
any advice?

Try correcting the name to the name of an existing getter, or defining a getter or field named 'path'

I am trying a create pdf in flutter
package name: syncfusion_flutter_pdf: ^19.4.47-beta
Add an exclamation mark after the final closing parentheses, so it looks like ())!.path

Flutter Html View Returns Error When Imported

I have successfully installed the dependency in pubspec.yaml and the exit code was 0.
When I import 'package:flutter_html_view/flutter_html_view.dart'; It shows that it has been imported via vs code (It underlines it as imported but not used)**
But when I save or restart my emulator, it will refuse to build. returning the following errors:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:326:49: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
- 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
List<TextSpan> children = previous.text.children != null
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:327:41: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
- 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
? new List.from(previous.text.children)
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:326:49: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
- 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
List<TextSpan> children = previous.text.children != null
^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_markdown-0.2.0/lib/src/builder.dart:327:41: Error: The getter 'children' isn't defined for the class 'InlineSpan'.
- 'InlineSpan' is from 'package:flutter/src/painting/inline_span.dart' ('/C:/src/flutter/packages/flutter/lib/src/painting/inline_span.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'children'.
? new List.from(previous.text.children)
^^^^^^^^```
What are your SDK constraints? You're using an extremely old version (0.2.0) of package:flutter_markdown from 2018, back from before Flutter was even stable. Using the latest compatible version (^0.6.2, ideally) should fix your issue.

The getter 'instance' isn't defined for the type 'FirebaseMessaging'

The getter 'instance' isn't defined for the type 'FirebaseMessaging'. Try importing the library that defines 'instance', correcting the name to the name of an existing getter, or defining a getter or field named 'instance'.
I am trying to implement this sample codehttps://github.com/FirebaseExtended/flutterfire/blob/master/packages/firebase_messaging/firebase_messaging/example/lib/main.dart
But it is showing above mentioned error. How to fix it?
firebase_messaging: ^7.0.3import 'package:firebase_messaging/firebase_messaging.dart';
The getter 'instance' is not available on firebase_messaging: ^7.x.x , you will need to upgrade to version 8