ERROR
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/searchable_dropdown-1.1.3/lib/searchable_dropdown.dart: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
^^^^^^^
/C:/src/flutter/.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
FAILURE: Build failed with an exception.
* Where:
Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1005
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit v alue 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 42s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
SOLUTION
There are Two Solutions for this error
- Use Alternative Package
- Do some changes in .pub-cache
Use Alternative Package
I switched from searchable_dropdown to search_choices and it works OK. Since both packages show similar functionality, should we keep this issue open?
Source (githubmemory.com) :- https://githubmemory.com/repo/icemanbsi/searchable_dropdown/issues/15
Do some changes in .pub-cache
To fix this issue you have to make some changes in searchable_dropdown.dart
First, go to C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/searchable_dropdown-1.1.3/lib/searchable_dropdown.dart
Click CTRL + Mouse Left Go To The “.subhead
” And Replace It With “.subtitle1
” Or Just Copy Paste This
TextStyle get _textStyle =>
widget.style ??
(_enabled && !(widget.readOnly ?? false)
? Theme.of(context).textTheme.subtitle1
: Theme.of(context)
.textTheme
.subtitle1
.copyWith(color: _disabledIconColor));
Latest posts by Sushant Kumar (see all)
- What is On-Page Optimization and Off-page Optimization - March 14, 2024
- [SOLVED] Flutter : PlatformException(sign_in_failed, com.google.android.gms.common.api.ApiException: 10: , null, null) - December 7, 2021
- [Solved] Flutter : Error: The getter ‘subhead’ isn’t defined for the class ‘TextTheme’ from package:flutter/src/material/text_theme.dart’ – searchable_dropdown - December 6, 2021