FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
118 stars 19 forks source link

Error: 'CarouselController' is imported from both 'package:carousel_slider/carousel_controller.dart' and 'package:flutter/src/material/carousel.dart'. #3849

Open Lars2024 opened 1 week ago

Lars2024 commented 1 week ago

Can we access your project?

Current Behavior

After updating to Xcode 16 this error occurred together with the necessary upgrade of Flutter. My App was working fine before. With the new environment the build of the app can not be completed and shows the following error: Error: 'CarouselController' is imported from both 'package:carousel_slider/carousel_controller.dart' and 'package:flutter/src/material/carousel.dart'.

Expected Behavior

The build is finalised like before without problems and all image carousels in my app work like several times before.

Steps to Reproduce

  1. command flutter run --release in Visual Studio Code
  2. Xcode is in parallel opened and set in Version 16
  3. Error Message: Failed to build iOS app Could not build the precompiled application for the device. Error (Xcode): ../../../../.pub-cache/hosted/pub.dev/carousel_slider-4.2.1/lib/carousel_slider.dart:9:1: Error: 'CarouselController' is imported from both 'package:carousel_slider/carousel_controller.dart' and 'package:flutter/src/material/carousel.dart'.

Reproducible from Blank

Bug Report Code (Required)

Error: Failure to copy to clipboard: PlatformException(copy fail)

Visual documentation

Bildschirmfoto 2024-09-19 um 16 29 37 Bildschirmfoto 2024-09-19 um 16 31 16

Environment

- FlutterFlow version: 4.1.89
- Platform: MacBook Pro
- Browser name and version: Safari 17.6
- Operating system and version affected: macOS Sonoma 14.6.1
- Xcode 16.0
- Flutter 3.24.3

Additional Information

There are several workarounds of this problem in GitHub which however did not work for me in the FlutterFlow low-code environment. Downgrading to Flutter Version 3.22.2 caused several additional problems. Therefore I think one of the proposed solutions e.g. hide CarouselController or use carousel_slider_plus should be implemented in FlutterFlow. Thank you in advance.

paulperez-dev commented 1 week ago

Hi @Lars2024,

Could you please verify if the following command helps you?

dart fix --apply

Also, are you using any of those packages in a custom widget?

Lars2024 commented 1 week ago

Hi Paul,

thank you for your feedback. Those packages are not used in custom widgets. Unfortunately the command does not help to resolve the issue.

It seems that the CarouselController in flutter 3.24 is causing the issue being called up twice with identical name.

Spixz commented 2 days ago

This problem was fixed in version 5.0.0 of carousel_slider, where the controller was renamed to CarouselSliderController. https://github.com/serenader2014/flutter_carousel_slider/issues/454#issuecomment-2276968985

I updated the package to version 5.0.0 and replaced CarouselController with CarouselSliderController in my code (which is not a very sustainable solution). This issue likely arose during a Flutter update. I am using the one of latest version of Flutter (3.24.1).

Lars2024 commented 2 days ago

Thank you for your feedback, Spixz !

Even though you created an interim solution the FlutterFlow-team should develop a sustainable standard solution for this issue in my view.