Skip to content

[Bug] AppBar envuelto en KeyedSubtree rompe compilación (PreferredSizeWidget error) #7166

@mojicabside

Description

@mojicabside

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

[Bug] AppBar wrapped in KeyedSubtree breaks compilation (PreferredSizeWidget error)

Expected Behavior: The project should compile successfully without errors. The Scaffold.appBar should generate a valid AppBar (which implements PreferredSizeWidget) instead of being wrapped in a KeyedSubtree. Pages that previously compiled should continue to build without modification. No manual code changes should be required in FlutterFlow projects, since the code is auto‑generated by the platform.

Actual Behavior: After the latest FlutterFlow update, the build fails with:

 appBar: KeyedSubtree(key: const FFNodeKey('AppBar_kd5t1vgd'), child: !isWeb ?           AppBar(
              ^
lib/pages/main_pages/main_home/main_home_widget.dart:250:83: Error: The argument type 'AppBar?' can't be assigned to the parameter type 'Widget'.
 - 'AppBar' is from 'package:flutter/src/material/app_bar.dart' ('/flutter/sdk/packages/flutter/lib/src/material/app_bar.dart').
 - 'Widget' is from 'package:flutter/src/widgets/framework.dart' ('/flutter/sdk/packages/flutter/lib/src/widgets/framework.dart').
      appBar: KeyedSubtree(key: const FFNodeKey('AppBar_cmsfaxkw'), child: !isWeb ?           AppBar(
                                                                                  ^
lib/pages/main_pages/main_home/main_home_widget.dart:250:15: Error: The argument type 'KeyedSubtree' can't be assigned to the parameter type 'PreferredSizeWidget?'.
 - 'KeyedSubtree' is from 'package:flutter/src/widgets/basic.dart' ('/flutter/sdk/packages/flutter/lib/src/widgets/basic.dart').
 - 'PreferredSizeWidget' is from 'package:flutter/src/widgets/preferred_size.dart' ('/flutter/sdk/packages/flutter/lib/src/widgets/preferred_size.dart').
      appBar: KeyedSubtree(key: const FFNodeKey('AppBar_cmsfaxkw'), child: !isWeb ?           AppBar(
              ^
Waiting for connection from debug service on Web Server...         44.6s
Failed to compile application.

Error: The argument type 'AppBar?' can't be assigned to the parameter type 'Widget'.


### Expected Behavior

The project should compile successfully without errors.
The Scaffold.appBar should generate a valid AppBar (which implements PreferredSizeWidget) instead of being wrapped in a KeyedSubtree.
Pages that previously compiled (e.g., main_config_widget.dart, main_home_widget.dart) should continue to build without modification.
No manual code changes should be required in FlutterFlow projects, since the code is auto‑generated by the platform.

### Steps to Reproduce

Steps to Reproduce:
1. Open an existing FlutterFlow project (mine has been running for 2 years without issues).
2. Do not make any local code changes.
3. Trigger a build/deploy from FlutterFlow after the latest platform update.
4. Observe that the generated code for `Scaffold.appBar` now wraps the `AppBar` inside a `KeyedSubtree`.
5. Compilation fails with the following error:

```dart
Error: The argument type 'KeyedSubtree' can't be assigned to the parameter type 'PreferredSizeWidget?'.
appBar: KeyedSubtree(key: const FFNodeKey('AppBar_kd5t1vgd'), child: !isWeb ? AppBar(...))

Error: The argument type 'AppBar?' can't be assigned to the parameter type 'Widget'.


### Reproducible from Blank

- [ ] The steps to reproduce above start from a blank project.

### Bug Report Code (Required)

IT4ol8jcw5NOm99Y7rqBYPlagSQRG2Y3bYE3lcpBazwbfe+uB4kqevfOTERvQuGmT2NAOk79q2oW06zGivGeFsFfCzCuR7pHwZZtVQzwRT6WMaqDFJWvdndAHcNTfnKmyLWJnBFSXcdvckJi6jqADN6ATT7sQIDtDTIkDq/LZO4=

### Visual documentation

<img width="686" height="761" alt="Image" src="https://github.com/user-attachments/assets/8e9c3f22-46fb-4da2-8fcf-76c7c157afb0" />

### Environment

```markdown
- FlutterFlow version: 
- Platform:
- Browser name and version:
- Operating system and version affected:

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
    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