Skip to content

Custom Function Testing : result always 0 and the test parameters don't persist #595

@kicsijohn

Description

@kicsijohn

Has your issue been reported?

  • I have searched the existing issues and confirm it has not been reported.
  • 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

1, I created a custom function and when I tested it always give me 0, but if I use the function in the app it gives the expected result

2, every time I change the code I try to test again I have to give the values again (it was persisted lately)

Expected Behavior

1, The test should show an accurate result
2, the test parameter values should persist

Steps To Reproduce

1, Create a custom function
2, use this code:

double? calculateActivity(
  List<int>? likedBy,
  double wlikedBy,
  List<int>? newPosts,
  double wnewPosts,
) {
  /// MODIFY CODE ONLY BELOW THIS LINE

  // sum all list elements in likedBy, multiply by wlikedBy
  if (likedBy == null || newPosts == null) {
    return null;
  }
  return likedBy.reduce((value, element) => value + element) * wlikedBy +
      newPosts.reduce((value, element) => value + element) * wnewPosts;

  /// MODIFY CODE ONLY ABOVE THIS LINE
}

with parameters:
CleanShot 2023-03-11 at 18 55 42

3, give some numbers in the test panel and observe that it shows always null.

And for 2
1, if you finished the test just change the tab to Function Code and change back to Test function
2, observe that the parameter values disappeared

Bug Report Code

Context

I just want to test my custom functions

Additional info

The null Result:
1,
CleanShot 2023-03-11 at 18 46 53
2,
https://user-images.githubusercontent.com/45784821/224504395-1376c4a1-56a6-4c8d-b104-735e11ed1aec.mp4

Environment

- FlutterFlow version: v3.1 Flutter 3.7.3
- Platform: Web
- Browser name and version: Chrome Version 111.0.5563.64 (Official Build) (x86_64)
- Operating system and version affected: macOS 13.2.1 (22D68)

Metadata

Metadata

Labels

closed: fixedstatus: confirmedIssue has been reproduced and confirmed as a bug.status: needs triageA potential issue that has not been confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions