FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
131 stars 26 forks source link

Conflict in data type for custom code using Library #4998

Open syg-eliseu opened 5 days ago

syg-eliseu commented 5 days ago

Can we access your project?

Current Behavior

The error occurs if I use a Google Map in the project and pass a function from the library that returns a LatLng as a parameter. Since the map definition in the project uses LatLng, when I try to use something in the project that returns this type of data, it interprets it as a different type, causing a type conflict. Log below:

lib/pages/home_page/home_page_widget.dart:140:69: Error: A value of type 'LatLng/1/' can't be assigned to a variable of type 'LatLng/2/?'.

  • 'LatLng/1/' is from 'package:test_library_ydxklu/flutter_flow/lat_lng.dart' ('dependencies/test_library_ydxklu/lib/flutter_flow/lat_lng.dart').
  • 'LatLng/2/' is from 'package:test/flutter_flow/lat_lng.dart' ('lib/flutter_flow/lat_lng.dart'). test_library_ydxklu_functions.testeLatLngLib()!,

Expected Behavior

I hope FlutterFlow can handle the data types received throughout the project so that I can use the custom code from my library as I previously did with Team Code. In its current state, using Libraries is unfeasible for us.

Steps to Reproduce

  1. Create a new FF project.
  2. Add a function to the project that returns a LatLng, and inside the function, include only return new LatLng(0, 0); for testing purposes.
  3. In a project screen, add a Google Map and use the function as the map's parameter.
  4. Duplicate the project, rename the created function in the duplicate, and then publish it as a library.
  5. Open the initial project and import the library.
  6. In the project, add a new map that uses the function from the library this time.
  7. Enable the web platform in the project.
  8. Run the local execution with Chrome.
  9. You will see the error in the Device Logs panel.

Reproducible from Blank

Bug Report Code (Required)

ITESz/Hqx89gochK+s/1bvpqhQMnQzM5U+cFjtt+Zw8hfIznE5oLeM/CbhdLYtfnSn56OlaknnwKp8LTjvL9A8coBxaqbIBg1a5XQQHJfF+VbKa6PbiWSXElJJ9jfFSm4Z2jmhJRNfVqSXwl23GufvCrG3qCf9qOYwx5e6fDbOY=

Visual documentation

image

Environment

- FlutterFlow version: 5.0.12+
- Platform: Windows Desktop
- Browser name and version:
- Operating system and version affected: Windows 11

Additional Information

I identified the error occurring with the types:

But it may also be happening with other types.

Alezanello commented 3 days ago

Thank you so much for bringing this to our attention! I’ll make sure to forward it to our engineering team so they can work on a fix. We really appreciate your feedback!