Skip to content

Button component bg/color parameters cause invalid_constant error blocking build #7249

Description

@PlateBrain74

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

W polu Current Behavior wpisz:

`The Button component has two parameters (bg and color) with Color type. FlutterFlow generates default values using FlutterFlowTheme.of(context) in the const constructor, which causes these errors in the Dart analyzer:

  • invalid_constant: Invalid constant value (lines 345, 400)
  • undefined_identifier: Undefined name 'context' (lines 365, 420)

This completely blocks Test Mode and APK builds. The bug exists since the beginning of the project and is present in all project backups.

Expected Behavior

The Button component should build without errors. Default Color parameter values should not use FlutterFlowTheme.of(context) in the const constructor, as this is not valid Dart. FlutterFlow should either use a const Color as default, or not generate a default value at all.

`Additionally, the component cannot be deleted and replaced because FlutterFlow does not allow deleting components that are in use on pages.

Steps to Reproduce

  1. Create a Component with a Color parameter named "bg" or "color"
  2. Set the Default Value to FlutterFlowTheme.of(context).primary (or any theme color)
  3. Save the component
  4. Attempt to build the project or run Test Mode
  5. Observe build errors: "invalid_constant" and "undefined name 'context'" in button_widget.dart

Reproducible from Blank

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

Bug Report Code (Required)

IT4siMn1z892pbxZ15D+acFr/GAsJlA7auc4scl8bw4bF5joPLMQesnQTFRuOde0TFY3IlmY8HEexvfqv/LxVvUqYDmsGr58z7VTWgv/fDiiSpebELrsfW1fGdxTG0CO1pm7niRROsx1L11nw2a6HeyRa3PaCZzrO1cZDcqLJdeK2SrDX1iXc2URm05KZDPz

Visual documentation

Image

Environment

- FlutterFlow version: latest (web)
- Platform:Web
- Browser name and version:Microsoft Edge (latest)
- Operating system and version affected: Windows 11

Additional Information

This bug has been present since the beginning of the project. I confirmed it exists in project backups from 05/05/2026. The bug cannot be fixed through the UI because default values revert automatically. The component cannot be deleted and replaced because FlutterFlow does not allow deleting components that are in use on pages. This is blocking my app from reaching the App Store before my planned launch date.

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