Skip to content

Code generation bug involving Action Blocks + custom widget callbacks + Update Page State #7241

Description

@flowlessfoxreverse

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

Hi FlutterFlow team,

I found what looks like a code generation bug involving Action Blocks + custom widget callbacks + Update Page State.

Setup
Page: ProjectPage
I have an Action Block (processPayment) used for payment logic.
Inside that Action Block, I open a custom widget in a dialog (StripePaymentComponentWidget / Stripe payment modal).
Inside the custom widget callback, I use normal visual builder actions:
Update Page State
set enum status
set payment intent id from callback response
I am not using custom code for those state updates.
Problem
FlutterFlow generates invalid code in:

lib/components/pages/client/project_page/project_page_model.dart

It outputs widget-scoped assignments like:

_model.stripePaymentOutcome = StripeCodes.Succeeded;
_model.paymentIntentId = paymentIntentId;
safeSetState(() {});
But this code is generated inside the ProjectPageModel, where _model and safeSetState() do not exist.

Compile error
Example error:

Error: The getter '_model' isn't defined for the type 'ProjectPageModel'.
Error: The method 'safeSetState' isn't defined for the type 'ProjectPageModel'.

Expected Behavior

Expected behavior
If Update Page State is used visually inside this callback, FlutterFlow should generate valid code for the current context, or prevent page-state updates from being used in a callback nested inside an Action Block.

At minimum, it should not emit _model... inside *_model.dart.

Steps to Reproduce

Steps to reproduce
Create a page with a page state variable, for example:

stripePaymentOutcome
paymentIntentId
Create an Action Block on that page, for example:

processPayment
Inside the Action Block:

add logic that opens a custom widget inside a dialog/modal
the custom widget should expose a callback with response values
example callback params:
status enum
payment intent id string
In the custom widget callback flow, add normal visual builder actions:

Update Page State
set the page enum variable from callback status
set the page string variable from callback payment intent id
Save and run/export the project.

Build for web.

Reproducible from Blank

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

Bug Report Code (Required)

IT4ojs/luIh2rsRE1qrucsJViSQWHHk2bIErl8pOGDwbfaKvPIlzac7sTBdvQsTiT1ZbKEWGuGIE+NWMhs79UPQrFwSqfYhq/pFQURbjXTu/aoTRPM6BdnckBeRUG0im3ImnviZCJtVhS3g82E+DffC8b3faJuL7Zwh9f6PHaOI=

Visual documentation

Image

AI selector - FlutterFlow AI Selector v1
project_id: jumper-media-rk2y5n
scope_kind: action_node
scope_name: processPayment
container_kind: action_block
node_key: t3ek3rht
node_type: Conditional Actions
widget_node_key: Scaffold_hr5hbdmg
trigger_type: CALLBACK

Environment

- FlutterFlow version: latest
- Platform: web
- Browser name and version: chrome
- Operating system and version affected:  mac os

Additional Information

2 packages are discontinued.
188 packages have newer versions incompatible with dependency constraints.
Try flutter pub outdated for more information.
Launching lib/main.dart on Web Server in debug mode...
Waiting for connection from debug service on Web Server...
lib/components/pages/client/project_page/project_page_model.dart:548:1: Error: The getter '_model' isn't defined for the type 'ProjectPageModel'.

  • 'ProjectPageModel' is from 'package:content_creation/components/pages/client/project_page/project_page_model.dart' ('lib/components/pages/client/project_page/project_page_model.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named '_model'.
    _model.stripePaymentOutcome = StripeCodes.Succeeded;
    ^^^^^^
    lib/components/pages/client/project_page/project_page_model.dart:549:1: Error: The getter '_model' isn't defined for the type 'ProjectPageModel'.
  • 'ProjectPageModel' is from 'package:content_creation/components/pages/client/project_page/project_page_model.dart' ('lib/components/pages/client/project_page/project_page_model.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named '_model'.
    _model.paymentIntentId = paymentIntentId;
    ^^^^^^
    lib/components/pages/client/project_page/project_page_model.dart:572:1: Error: The getter '_model' isn't defined for the type 'ProjectPageModel'.
  • 'ProjectPageModel' is from 'package:content_creation/components/pages/client/project_page/project_page_model.dart' ('lib/components/pages/client/project_page/project_page_model.dart').
    Try correcting the name to the name of an existing getter, or defining a getter or field named '_model'.
    _model.stripePaymentOutcome = responceCode;
    ^^^^^^
    Waiting for connection from debug service on Web Server... 105.5s
    Failed to compile application.

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