flutter 模态底版库导致问题

rqenqsqc  于 2022-11-17  发布在  Flutter
关注(0)|答案(1)|浏览(281)

我今天升级了我的flutter版本,发现了这个问题:

../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:102:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
      .push(ModalBottomSheetRoute<T>(
            ^^^^^^^^^^^^^^^^^^^^^
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:125:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
 - 'Object' is from 'dart:core'.
 - 'Future' is from 'dart:async'.
  return result;
         ^
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:28:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
      .push(ModalBottomSheetRoute<T>(
            ^^^^^^^^^^^^^^^^^^^^^
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/material_bottom_sheet.dart:50:10: Error: A value of type 'Object?' can't be returned from an async function with return type 'Future<T?>'.
 - 'Object' is from 'dart:core'.
 - 'Future' is from 'dart:async'.
  return result;
         ^
../../../../../AppData/Local/Pub/Cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/material_with_modal_page_route.dart:4:1: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
import '../modal_bottom_sheet.dart';
^^^^^^^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script 'C:\FlutterSDK\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1165

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\FlutterSDK\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
Exception: Gradle task assembleDebug failed with exit code 1

在我尝试调试它之后它出现了,有什么解决方案或者我应该删除这个库吗?

q8l4jmvw

q8l4jmvw1#

我在升级flutter后遇到了同样的问题。我意识到这是一个与flutter开发环境的兼容性问题。解决方案是同时更新dev通道:

flutter channel dev
flutter upgdade

相关问题