FlutterFlow / flutterflow-issues

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

Not able to add imports in functions #3662

Closed DanielvdBerg95 closed 1 week ago

DanielvdBerg95 commented 3 weeks ago

Can we access your project?

Current Behavior

I created this BugReportProject to show what is happening.

I can add any import statements to the custom functions. For example in the code below I am trying to add typed_data import 'dart:typed_data' show Uint8List;

However when I create a new function and add it, as soon as I save it removes the import statement, and it also does not give me the option to save the code when editing the function again.

Expected Behavior

We should be able to add import statements and add dependencies to our code. This has always been the case till today after the new flutterflow update. This is breaking all of my projects.

Steps to Reproduce

  1. Create new Custom function
  2. Name it whatever you want
  3. Provide arguments and return value
  4. Add an import for a specific package to be used
  5. Save the function

It will then remove the import statement once you save and it cannot be added again afterwards. The save option does not become available when you try

Reproducible from Blank

Bug Report Code (Required)

IT4Kls/l6otPm9tH1s7yKe9ajikXQ3ojUOYslu1HZA8bC72rG7l/TMnOVBJuOLC0YXxmJE20jn8dw6jemvDlIfU4FwidbbpOyZNudA3NfEagV8WgPrmKXm5/AplXCFyZ55irvh15BPhtSVog20ODONmuZDLqQrLzO0URJMn+C5OK2SrDX1iXc2URm05KZDPz

Visual documentation

https://github.com/user-attachments/assets/df305825-d8d1-4f45-aead-133dae62e79e

Environment

- FlutterFlow version: v4.1.83+
- Platform: All
- Browser name and version: Chrome, Brave and Desktop app! 
- Operating system and version affected: Windows 10 and Ubuntu

Additional Information

All of my projects running on custom functions are now filled with errors, costing me time that I now need to spend on going through this once you resolve the issue to add all the imports again. I cannot give you access to any of the client apps, so please don't even ask.

Alezanello commented 3 weeks ago

Hi there!

Custom Functions do not support adding imports. If you need to include imports, classes, or have multiple functions calling each other, you'll need to create a Custom Action instead. Custom Actions allow you to add whatever you need to the code, giving you the flexibility to return exactly what you need for your project.

image.png
github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

Alezanello commented 1 week ago

Closing this issue since we haven't heard back from you. If you are still facing the problem please submit a new issue. Have a great day!