skip to Main Content

Getting this error for build failure:

error build: ../../../development/flutter/.pub-cache/hosted/pub.dev/bubble_bottom_bar-2.0.0/lib/bubble_bottom_bar.dart:195:14: Error: ‘Badge’ is imported from both ‘package:badges/src/badge.dart’ and ‘package:flutter/src/material/badge.dart’.

Using code from https://codecanyon.net/item/flyweb-for-web-to-app-convertor-flutter-admin-panel-v10/26840230

Can anyone suggest where and what needs to be edited to get this issue resolved.

Have tried updating the Flutter with following commands

Flutter clean
Flutter pub get

Have also reinstalled pods for ios and still failing to build on Flutter build ios

2

Answers


  1. Badge is coming from both material and badge package. Flutter material provide by default.

    If you wish to use the package one, you can do

    import 'package:badges/src/badge.dart' as badge; 
    

    Now to use it, call badge.Badge(....

    Login or Signup to reply.
  2. The Badge is being imported from both material.dart and badges.dart which is a dependency of the bubble_bottom_bar. The following worked for me:

    In the bubble_bottom_bar.dart, I modified the library and changed the import of material.dart as follows:

    import 'package:flutter/material.dart' hide Badge
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search