Flutter 3.10 へ移行後にアプリ起動時にエラー

エラー問題と解決策

Flutter SDK 3.10 の問題

起動時に下記のようなエラーが出てきたので調べてみましたが、ここ最近で同じようなエラーで悩まされている方も何人かいらっしゃったのでメモしておきます。

Launching lib/main.dart on Chrome in debug mode...
: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onSingleTapUp' has type 'TapUpDetails', which does not match the corresponding type, 'TapDragUpDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onSingleTapUp'.
- 'TapUpDetails' is from 'package:flutter/src/gestures/tap.dart' ('/usr/local/flutter/packages/flutter/lib/src/gestures/tap.dart').
- 'TapDragUpDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/usr/local/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragUpDetails', or, for a covariant parameter, a subtype.
  void onSingleTapUp(TapUpDetails details) {
                                  ^
/usr/local/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2161:8: Context: This is the overridden method ('onSingleTapUp').
  void onSingleTapUp(TapDragUpDetails details) {
       ^

: Error: The parameter 'details' of the method '_TextFieldSelectionGestureDetectorBuilder.onDragSelectionEnd' has type 'DragEndDetails', which does not match the corresponding type, 'TapDragEndDetails', in the overridden method, 'TextSelectionGestureDetectorBuilder.onDragSelectionEnd'.
- 'DragEndDetails' is from 'package:flutter/src/gestures/drag_details.dart' ('/usr/local/flutter/packages/flutter/lib/src/gestures/drag_details.dart').
- 'TapDragEndDetails' is from 'package:flutter/src/widgets/tap_and_drag_gestures.dart' ('/usr/local/flutter/packages/flutter/lib/src/widgets/tap_and_drag_gestures.dart').
Change to a supertype of 'TapDragEndDetails', or, for a covariant parameter, a subtype.
  void onDragSelectionEnd(DragEndDetails details) {

                                         ^
/usr/local/flutter/packages/flutter/lib/src/widgets/text_selection.dart:2839:8: Context: This is the overridden method ('onDragSelectionEnd').
  void onDragSelectionEnd(TapDragEndDetails details) {

       ^

macos_uiライブラリに互換性がないことが原因のようです。

Flutter 3.10 アプリ起動時にエラーの解決策

pubspec.yamlに下記のように追加。

dependency_overrides:
  macos_ui:
    git:
      url: https://github.com/Mayb3Nots/macos_ui.git
      ref: dev

参考元
https://github.com/rwbr/flutter_neat_and_clean_calendar/issues/55
https://github.com/macosui/macos_ui/issues/424

About Naoki 24 Articles
デザインを含めたフロントエンドから、インフラ含めたバックエンドまで広く浅く活動しているエンジニアです。主にSaasの開発・営業・運営管理などをしております。毎日デスマーチがモットーなブラックエンジニアです。 私が管理しているクラウドソフトウェアがこちらです→まとめツール倶楽部『MTCsystem』

Be the first to comment

Leave a Reply

Your email address will not be published.


*


CAPTCHA


日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)