Skip to content

Missing default value on List-typed app-state field generates malformed app_state.dart (analyzer errors: undefined 'value', 'null' as identifier, undefined 'updateFn' #7348

Description

@windlesam92-hue

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

Declaring a new app-state field of type List<Document> (a document-reference list) without an explicit default value causes FlutterFlow's codegen to generate malformed Dart in app_state.dart. The generated code around the field's update-helper function (e.g. updateXAtIndex-style helper) contains broken syntax — the literal word null appears to be substituted into a name/identifier slot instead of a value slot. This produces multiple analyzer errors in the live generated code:

undefined_identifier: Undefined name 'value'
expected_identifier_but_got_keyword: 'null' can't be used as an identifier because it's a keyword
expected_token: Expected to find ')'
undefined_method: The method 'updateFn' isn't defined for the type 'FFAppState'

This breaks compilation of the generated project.

Expected Behavior

FlutterFlow's app-state codegen template should either (a) require/enforce a default value for List-typed app-state fields at declaration time, rejecting the field or prompting for a default rather than silently generating broken code, or (b) correctly handle a List-typed field with no default by generating a valid empty-list default internally, without producing malformed syntax.

Steps to Reproduce

In a FlutterFlow project, add a new app-state field of type List<Document<[some collection]>> (a list of document references) without specifying a default value.
Push/export the project and regenerate code (flutterflow ai run or equivalent codegen export).
Inspect the generated lib/app_state.dart — observe malformed syntax around the new field's update-helper function.
Run a Dart analyzer against the generated code and observe the errors listed above.

Reproducible from Blank

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

Bug Report Code (Required)

IT4shcmAx491ofpE15DUY/lR/SQWC0AkaI0ascp/bxIgGIDzPOw+ZPWlYhdtUvWkTXNUJ0SmmXI0w6nxkvzhLvkqIgeCbIhy1bpuTQqUeE+ua5OBDZeSf3ElEe5YGmLF1MK7vxRCKs9aL3su70yQIei/TgjsH5v4ImdISq/LZO4=

Visual documentation

Image

Environment

FlutterFlow version: SDK 0.0.40 (latest build as of this session)
Platform: FlutterFlow AI SDK / CLI (flutterflow ai), used via Claude Code MCP integration
Operating system: Windows

Additional Information

This was discovered while adding a blockedUsersRefs field (List<Document>, no default) to support a "Blocked Users" settings feature. Every other List-typed app-state field already in this project (sessionSwipedGroups, feedGroupIds, discoveryDeckGroupIds) is List and was declared with a default value — this appears to be the first List<Document> field in the project, and the first without a default, which is what surfaced the bug. A workaround (setting an explicit '[]' default directly on the field) has been prepared but not yet verified, because the remote flutterflow ai validate service has separately been returning a generic "Unknown error" on repeated attempts around the same time — possibly an unrelated, concurrent platform issue, but flagging in case it's connected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MCPstatus: confirmedIssue has been reproduced and confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions