Skip to content

[Widget Previewer] Expanding a preview group throws bool is not a subtype of double? #191242

Closed

Description

@shell-echo

Steps to reproduce

This reproduces in a new, otherwise empty Flutter project and when the previewer is started directly in Chrome. No IDE is involved.

  1. Run flutter create --empty --project-name preview_group_repro preview_group_repro.
  2. Replace lib/main.dart with the code sample below.
  3. Run flutter widget-preview start --no-pub --web-server.
  4. Open the printed URL in Chrome.
  5. Collapse the Probe group, then expand it again.

Expected results

The group should expand and restore both previews without throwing an exception.

Actual results

The first preview becomes a red error surface and the browser console reports:

TypeError: true: type 'bool' is not a subtype of type 'double?'

This also occurs when running flutter widget-preview start --no-pub --web-server directly in Chrome, so VS Code is not required to reproduce it.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/widget_previews.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(body: Center(child: Text('Hello World!'))),
    );
  }
}

@Preview(name: 'First', group: 'Probe', size: Size(360, 240))
Widget firstPreview() => const ColoredBox(color: Colors.teal);

@Preview(name: 'Second', group: 'Probe', size: Size(360, 240))
Widget secondPreview() => const ColoredBox(color: Colors.deepOrange);

Screenshots or Video

Screenshot from the standalone Web Previewer

Captured immediately after step 5.

Image

Logs

Logs
$ flutter analyze
Analyzing preview_group_repro...
No issues found!

$ flutter widget-preview start --no-pub --web-server
Creating widget preview scaffolding at: <project>/.widget_preview
Launching the Widget Preview Scaffold on Web Server...
Launching lib/main.dart on Web Server in debug mode...
lib/main.dart is being served at http://localhost:<port>

Browser console after expanding the group:
The following _TypeError was thrown building SingleChildScrollView:
TypeError: true: type 'bool' is not a subtype of type 'double?'

The relevant error-causing widget was:
  SingleChildScrollView
  SingleChildScrollView:<project>/.widget_preview/lib/src/widget_preview_rendering.dart:781:16

Stack (relevant frames):
package:flutter/src/widgets/scroll_position.dart 538:90 restoreScrollOffset
package:flutter/src/widgets/scroll_controller.dart 307:12 createScrollPosition
package:flutter/src/widgets/scrollable.dart 674:5 didChangeDependencies

The generated scaffold uses ExpansionTile(key: PageStorageKey(group.name)) at widget_preview_rendering.dart:279-280. The failing SingleChildScrollView is at line 781. ScrollPosition.restoreScrollOffset reads PageStorage state as double? at scroll_position.dart:538, so this appears to be a PageStorage state collision between the group expansion state and the descendant scrollable offset.

Related: #97583 describes the underlying PageStorage type collision. Grouping support was introduced in #174849.

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.47.0, on macOS darwin-arm64, locale zh-Hans-CN)
    • Framework revision 4cf2416426 (2026-08-11)
    • Engine revision 5f77625673
    • Dart version 3.13.0
    • DevTools version 2.60.0
[✓] Chrome - develop for the web
    • Google Chrome 151.0.7922.138
[✓] Network resources
    • All expected network resources are available.

• No issues found!

(The connected-device section is omitted because this reproduces on the Web Previewer and contains local device identifiers.)

Activity

  1. suryaKommana2662 commented on Aug 18, 2026

    @suryaKommana2662
    Contributor

    @shell-echo Thanks for the detailed reproduction steps and minimal example. I was able to reproduce the issue on Flutter 3.47.0 using the standalone Widget Previewer with Chrome. When collapsing and expanding the Probe preview group, the first preview displays an error, as shown in the attached screenshot.
    Image
    I also tested the same reproduction on Flutter 3.44.7, but I was unable to reproduce the issue there. This indicates that the issue is reproducible on Flutter 3.47.0 but not on 3.44.7. Routing this issue to team-tool for further investigation.

  2. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    team-devexpOwned by the Developer Experience team
    team-toolOwned by Flutter Tool team
    and removed
    in triagePresently being triaged by the triage team
    team-devexpOwned by the Developer Experience team
    on Aug 18, 2026
  3. github-actions commented on Sep 4, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  4. locked as resolved and limited conversation to collaborators on Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    found in release: 3.47Found to occur in 3.47has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-toolOwned by Flutter Tool teamtoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions