skip to Main Content

Today, I upgrade my project version from 3.3.x to 3.7.0. and it has error below.

Launching lib/main.dart on iPhone 14 Pro in debug mode...
Running pod install...                                             13.0s
Running Xcode build...                                                  
Xcode build done.                                           131.3s
Failed to build iOS app
Error (Xcode): ../../.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'.


Could not build the application for the simulator.
Error launching application on iPhone 14 Pro.

How can I solve this problem… can anyone help?

2

Answers


  1. Error: 'ModalBottomSheetRoute' is imported from both 
    'package:flutter/src/material/bottom_sheet.dart' and
     'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
    

    Hide all conflicting classes that you don’t use, so that the Compiler
    only sees the class it should use.

    import 'package:flutter/src/material/bottom_sheet.dart' hide ModalBottomSheetRoute
    import 'package:modal_bottom_sheet/src/bottom_sheet_route.dart';
    

    or

    Use "as" keyword to provide the name to the class you want to use.
    Then use this name as a prefix of the class.

    import 'package:flutter/src/material/bottom_sheet.dart' as otherName;
    import 'package:modal_bottom_sheet/src/bottom_sheet_route.dart';
    
    Login or Signup to reply.
  2. modal_bottom_sheet: ^3.0.0-pre

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search