Home > Enterprise >  Flutter not compiling error Error: The method 'CustomStyle.copyWith' has fewer named argum
Flutter not compiling error Error: The method 'CustomStyle.copyWith' has fewer named argum

Time:05-06

When I tray to compile (there are no programming errors in screen) but in compilation show these error logs:

*/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.4 1/lib/custom_style.dart:17:13:

Error: The method 'CustomStyle.apply' has fewer named arguments than those of overridden method 'TextStyle.apply'. TextStyle apply({ ^

This is my pubspec.yaml

name: myprject description: A new Flutter project. publish_to: 'none' version: 1.0.0 1 environment: sdk: ">=2.12.0 <3.0.0" dependencies:
flutter: sdk: flutter cupertino_icons: ^1.0.2
flutter_staggered_grid_view: ^0.4.1 rflutter_alert: ^2.0.4
connectivity: ^3.0.6 path_provider: ^2.0.6 dio: ^4.0.1
percent_indicator: ^3.4.0 flutter_archive: ^4.1.0
flutter_webview_plugin: ^0.4.0 flutter_inappwebview: ^5.3.2
flutter_staggered_animations: ^1.0.0 flutter_scale_tap: ^1.0.5
intl: ^0.17.0 shared_preferences: ^2.0.8 flutter_svg: ^0.23.0 1
styled_text: ^3.0.4 1 audio_service: ^0.18.1 just_audio: ^0.9.18
url_launcher: ^6.0.16 permission_handler: ^8.3.0 animations: ^2.0.2 transformer_page_view: ^0.1.6 chewie: ^1.2.2
video_player: ^2.2.7 flutter_colorpicker: ^1.0.3 vibration: ^1.7.4-nullsafety.0 flare_flutter: ^3.0.2 rive: ^0.8.1
screenshot: ^1.2.3 share_plus: ^3.0.4 external_path: ^1.0.1
flame: ^1.0.0 flutter_fortune_wheel: ^1.2.0 elliptic_text: ^1.0.1 9

dev_dependencies: flutter_test: sdk: flutter sqflite: ^2.0.0 4

flutter_lints: ^1.0.0 http: ^0.13.3 provider: ^5.0.0

flutter: uses-material-design: true assets: - assets/ fonts:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.10.5, on Microsoft Windows [Versión 10.0.19044.1645], locale es-MX)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.1.6)
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.66.2)
[√] Connected device (6 available)
[√] HTTP Host Availability

CodePudding user response:

This looks like a mismatch between your Flutter version (which is relatively new) and a (half year) old version of the styled_text package. As I understand, there was a change in the function signature of the copyWith function in Style classes. Simply updating the dependency should work. Replace it in your pubspec.yaml file:

styled_text: ^5.1.0

As a general hint, you can run flutter pub outdated to identify packages that can be updated.

  • Related