Skip to content

Reserved-word list for typed-SDK codegen is missing several Map/Object members (e.g. length), breaking compilation project-wide #7425

Description

@LightworkerMark

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

The FlutterFlow AI SDK generates a per-collection Fields class (e.g. ScriptsFields) that extends MapBase<String, DslType>. Field names are turned into Dart identifiers by a _NameAllocator in lib/src/dsl/project_sdk_generator.dart, which checks each name against a hardcoded _reserved set before emitting it as a final property.

That _reserved set already includes some Map interface members -- clear, keys, remove, values -- so the collision case was clearly considered. But it's missing several others, including length. A collection field literally named length (e.g. this project's scripts.length, a duration-in-minutes field) gets emitted verbatim:

final length = ffai.ProjectCollectionFieldHandle(
name: "length",
key: "",
typeName: "Integer",
type: ffai.int_,
description: "",
);

MapBase (via Map) already declares int get length. Declaring a same-named instance field of a different, non-int type on a subclass doesn't compile:

lib/flutterflow_project/schemas.dart:1137:23: Error: A value of type 'ProjectCollectionFieldHandle' can't be assigned to a variable of type 'int'.
lib/flutterflow_project/schemas.dart:1210:45: Error: A value of type 'Object?' can't be returned from a function with return type 'DslType?'.

This breaks flutterflow ai run and flutterflow ai validate outright for the ENTIRE project -- any script, regardless of whether it touches the colliding collection at all -- since both commands compile the generated typed SDK as part of their pipeline. flutterflow ai refresh-context and flutterflow ai inspect are unaffected, since neither actually compiles the generated Dart file -- they just write or read it, so a broken schemas.dart can sit on disk undetected until run/validate (or opening the file in an IDE) is attempted.

Confirmed this isn't fixed by upgrading: reproduced identically on SDK build b5c8a09d and again after upgrading to the latest build (287a31d5, released 2026-08-21) via flutterflow ai upgrade.

Root cause and fix confirmed precisely: locally adding the missing names (length, isEmpty, isNotEmpty, entries, containsKey, containsValue, addAll, addEntries, forEach, map, cast, update, updateAll, removeWhere, putIfAbsent, toString, hashCode, runtimeType, noSuchMethod) to the _reserved set in the vendored copy of project_sdk_generator.dart, then regenerating, fully resolves the compile failure -- validate goes from failing on schemas.dart to a clean pass. This is a workaround only, in a vendored file that flutterflow ai upgrade overwrites -- not a substitute for shipping the fix.

Expected Behavior

A collection field name that collides with an inherited Map or Object member (length, isEmpty, entries, toString, hashCode, etc.) should be disambiguated the same way clear/keys/remove/values already are, so the generated typed SDK always compiles regardless of what a project's own field names happen to be.

Steps to Reproduce

Step 1: Have a Firestore (or Postgres) collection with a field literally named length (or isEmpty, entries, toString, or another Map/Object member not in the SDK's reserved-word list).
Step 2: Run flutterflow ai validate <any-script>.dart --project-id <id> (or flutterflow ai run) against that project.
Step 3: Observe the compile failure in lib/flutterflow_project/schemas.dart, pointing at the colliding field.

Reproducible from Blank

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

Bug Report Code (Required)

IT4ok8nf8Y92xOUA7qqMbcFVmSQsQ2Ika7gJkspBZywgfZzzBLN/fPfQP1puZ+mmTHNLemacp14DzMLsht7LKfVdJgSec4g+/pBIUQyWUT+gR4+TF7qgQUdTHcBUGn7Cyrejsx1NC7N0WiU67WCbetmyVgLAQa7NPEQ8Sq/LZO4=

Visual documentation

bug found by Claude Code

Environment

FlutterFlow version: not captured directly (reproduced via the FlutterFlow AI SDK CLI, not the web editor)
Platform: FlutterFlow AI SDK (CLI), builds b5c8a09d and 287a31d5 (the latest as of 2026-08-21) -- reproduces identically on both
Browser name and version: N/A -- not encountered via the web editor
Operating system and version affected: Windows 11 (local machine)

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    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