
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


Be the first to comment