Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Function can not be saved with the specific function name. #5402

Open
2 tasks done
satoshikumano opened this issue Feb 12, 2025 · 6 comments
Open
2 tasks done
Assignees
Labels
status: can't reproduce Following the reported steps did not reproduce the bug.

Comments

@satoshikumano
Copy link

Can we access your project?

  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

Step to reproduce:

  • Create enum "TransportBureau"
  • Create custom function:
    • name: "convertStringToTransportBureau"
    • Return type: TransportBureau (Nullable)
    • Argument: transportBureauString (String/ Nullable)
  • Edit function body returns null
  • Click Save

Current Behavior:

"The function is empty or cannot be parsed. Make sure not to modify code outside of the designated area."

If I change function name to "convertToTransportBureau", save works fine without other changes.

Expected Behavior

Expected Behavior:

Save works fine, or give appropriate error message such as "Function signature is too long."

Steps to Reproduce

  • Create enum "TransportBureau"
  • Create custom function:
    • name: "convertStringToTransportBureau"
    • Return type: TransportBureau (Nullable)
    • Argument: transportBureauString (String/ Nullable)
  • Edit function body returns null
  • Click Save

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

IT4wls/qx412rtxE17rAccFv+TwWGDs5aucele1hRis8JJToPLAUZ8zBM05vZr3nTHxme1n8pHoy/PfqiPOXUPU7ByuYRaJZzpdqZwzMTkOhMKqvDLiJfW1STMRgChWf07S4ngknBNt2WHAS112QfueycC7aN7rGOWojH/2LKdeK2SrDX1iXc2URm05KZDPz

Visual documentation

Image

Environment

- FlutterFlow version: 5.1.3
- Platform: Web
- Browser name and version: Using macOS FF native editor
- Operating system and version affected: macOS 14.5(23F79)

Additional Information

No response

@satoshikumano satoshikumano added the status: needs triage A potential issue that has not been confirmed as a bug. label Feb 12, 2025
Copy link
Collaborator

Hello!

I wasn't able to replicate the issue. I created a function with a long name, and it saved correctly without any problems. It’s possible that the function itself had an issue earlier, or the system didn’t detect it until you changed the name and synced properly.

Let me know if the issue happens again, and I’d be happy to investigate further!

image.png

@Alezanello Alezanello self-assigned this Feb 12, 2025
@Alezanello Alezanello removed the status: needs triage A potential issue that has not been confirmed as a bug. label Feb 12, 2025
@Alezanello Alezanello added the status: can't reproduce Following the reported steps did not reproduce the bug. label Feb 12, 2025 — with Linear
@satoshikumano
Copy link
Author

satoshikumano commented Feb 13, 2025

@Alezanello

Thank you for your confirmation.

It seems the length of function name is not the factor of the bug.
I could reproduce the issue in the blank project with following steps.
Could you confirm the same steps?

  • Create blank project.
  • Create Enum: TransportBureau with values "aaaaaa", "bbbbbb"
  • Create Custom function:
    • Name: convertStringToTransportBureau
    • Return type: TransportBureau (Nullable)
    • Argument:
      • Name: transportBureauString
      • Type: String (Nullable)
    • Function body: just return null
  • Save function.

"The function is empty or cannot be parsed. Make sure not to modify code outside of the designated area."

If I change name to convertTransportBureau, save works fine.

Copy link
Collaborator

Hello again!

I believe the main issue here isn’t just about being able to save the function, but rather a potential issue with the custom function itself. It seems that changing the function name might be overriding an underlying error, allowing you to save it.

From my understanding, FlutterFlow doesn’t support returning null for an Enum. I recommend recreating the function with the "nullable" option disabled and ensuring that it always returns a default Enum value.

This should allow the function to save properly without requiring a name change as a workaround. Let me know if you run into any issues!

@satoshikumano satoshikumano changed the title Custom Function can not be saved when the function name is long. Custom Function can not be saved with the specific function name. Feb 14, 2025
@satoshikumano
Copy link
Author

satoshikumano commented Feb 14, 2025

@Alezanello

Hello.

FlutterFlow doesn’t support returning null for an Enum

Flutter Flow UI allows it. Should not use this functionality?

Image

Copy link
Collaborator

I'll take a look at that! In the meantime, try adding an .empty status inside the enum, and instead of returning null, return the .empty enum value.

Copy link
Collaborator

Hello again!

Did the solution provided help resolve the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: can't reproduce Following the reported steps did not reproduce the bug.
Projects
None yet
Development

No branches or pull requests

2 participants