I’m encountering an issue with the pin_code_fields package while using Flutter version 3.24.2. The error is due to the TextTheme.button property being removed in recent Flutter versions, which causes build failures.
`../../../.pub-cache/hosted/pub.dev/pin_code_fields-7.4.0/lib/src/pin_code_fields.dart:669:56: Error: The getter ‘button’ isn’t defined for the class ‘TextTheme’.
- ‘TextTheme’ is from ‘package:flutter/src/material/text_theme.dart’.
Try correcting the name to the name of an existing getter, or defining a getter or field named ‘button’.
color: Theme.of(context).textTheme.button!.color,
^^^^^^
…
`
Flutter Version:
Flutter 3.24.2 • channel stable • https://github.com/flutter/flutter.git Framework • revision 4cf269e36d (3 weeks ago) • 2024-09-03 14:30:00 -0700 Engine • revision a6bd3f1de1 Tools • Dart 3.5.2 • DevTools 2.37.2
How can I resolve this issue without downgrading Flutter? Are there any known fixes or updates to the pin_code_fields package that address this issue?
If manual changes are necessary, what would be the recommended way to safely modify the package or use an alternative approach?
I checked for updates to the pin_code_fields package but found that the latest version still uses the deprecated TextTheme.button property.
Attempted to manually edit the package files in .pub-cache, but faced permission issues when trying to modify them.
Anoch Dissanayake is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
update the package pin_code_fields
and change the code->
color: Theme.of(context).textTheme.labelLarge!.color,