Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modal bottom sheet library causing problems

Tags:

flutter

dart

I upgraded today my flutter version and found out that problem:

../../../../../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

It shows up after I am trying to debug it, is there eany solution or I should remove this library?

like image 793
Maciek Avatar asked Jun 05 '26 07:06

Maciek


1 Answers

So this issue is due to name clashes in flutter 3.7 and modal_bottom_sheet:2.1.0

Since flutter 3.7 release this compile time issues started, Library maintainer already published 3.0.0-pre version where they rename any ModalBottomSheetRoute class reference to ModalSheetRoute. Use this version modal_bottom_sheet: ^3.0.0-pre

like image 134
Ashish Avatar answered Jun 07 '26 00:06

Ashish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!