Skip to content

Custom data type struct files missing import for Firestore record class when field type is a document reference #7153

@1stthingapps

Description

@1stthingapps

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

When a custom data type (struct) includes a field typed as a Firestore document reference, the generated Dart file references the corresponding record class (e.g. EventsRecord, ActivityRecord) but does not include the required import statement for it. This causes a compile error in any local Flutter build via the VS Code extension.

Example from know_d_t_struct.dartEventsRecord is used throughout the file but the import is never emitted:

Error: Type 'EventsRecord' not found.

Three files affected in my project:

Generated file | Record class used | Missing import -- | -- | -- structs/user_events_d_t_struct.dart | EventsRecord | import '/backend/schema/events_record.dart'; structs/know_d_t_struct.dart | EventsRecord | import '/backend/schema/events_record.dart'; structs/user_activity_d_t_struct.dart | ActivityRecord | import '/backend/schema/activity_record.dart';


Expected Behavior

The generated struct file should include an import for the Firestore record class it references, the same way that index.dart and other generated files include their dependencies. For example:

import '/flutter_flow/flutter_flow_util.dart';
import '/backend/schema/events_record.dart'; // ← this line should be generated

Steps to Reproduce

  1. Create a Firestore collection (e.g. events).
  2. Create a custom data type with a field whose type is set to a document from that collection.
  3. Download the generated code via the FlutterFlow VS Code extension.
  4. Attempt a local Flutter build (flutter run).
  5. Observe compile error: Type 'EventsRecord' not found in the generated struct file.

Note: deleting the local download folder and re-syncing produces the same result — the bug is in the generator, not the cached files.

Reproducible from Blank

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

Bug Report Code (Required)

IT4wi+fl4otItbxa15DuccdF9SkWCDs5RJ0vi8F+eCs8JJToPLAUZ8zBM05vZryrdH9UJVmWgmQd7PfqhuzlFccVEAqZY65GwZNITj3MQkKmRaXWPYe7fW1QTZ9QIHLC5rWruAl4Wep0WHwN3EOqHuStb3PYJrrUITIwRM+LKdeK2SrDX1iXc2URm05KZDPz

Visual documentation

Its not a visual issue

Environment

- FlutterFlow version: 6.6.121+
- Platform: Windows
- Browser name and version: Chrome (but using MCP, Claude Code and VS Code)
- Operating system and version affected: Windows 11

Additional Information

A patch script is required after every sync as a workaround:

// The generated file contains this usage:
EventsRecord? _eventRef;
EventsRecord? get eventRef => _eventRef;

// But the file header only has:
import 'package:cloud_firestore/cloud_firestore.dart';
import '/backend/schema/util/firestore_util.dart';
import '/backend/schema/util/schema_util.dart';
import '/backend/schema/enums/enums.dart';
import 'index.dart';
import '/flutter_flow/flutter_flow_util.dart';
// Missing: import '/backend/schema/events_record.dart';

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageA potential issue that has not been confirmed as a bug.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions