Skip to content

Error: The getter 'subtitle1' isn't defined for the class 'TextTheme' #260

@AmolPatil-Git

Description

@AmolPatil-Git

pub.dev/dropdown_button2-1.9.4/lib/dropdown_button2.dart:1667:51: Error: The getter 'subtitle1' isn't defined for the class 'TextTheme'.

This appears to be due to changes in the Flutter SDK where subtitle1 has been renamed or deprecated.

To Reproduce
Steps to reproduce the behavior:

  1. Use Flutter version 3.0.0 (or the latest version as of this writing).
  2. Add dropdown_button2: ^1.9.4 to pubspec.yaml.
  3. Run the project.
  4. See the error in the console output.

Expected Behavior
The package should use the updated TextTheme properties compatible with the latest Flutter SDK. Specifically, the subtitle1 should be replaced with titleMedium or another appropriate property.

Proposed Solution
Update the code in dropdown_button2.dart as follows:

// Original code
style: Theme.of(context).textTheme.subtitle1,

// Updated code
style: Theme.of(context).textTheme.titleMedium,
<img width="702" alt="Screenshot 2024-05-30 at 7 27 38 PM" src="https://github.com/fluttercommunity/flutter_uploader/assets/163115830/33d34469-dbb2-4064-857e-d6be36940402">


Could you please update the package to be compatible with the latest Flutter SDK? This would greatly help the community and avoid similar issues in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions