Skip to content

_DraggableScrollableSheetState does not dispose extent. #133705

@polina-c

Description

@polina-c

PR that marks the leak: #133693

Steps to repro:

  1. Remove notDisposedAllowList added by the PR
  2. Run the updated test library with 'flutter run '
  3. Observe the test failure

I tried to invoke _extent.dispose() in dispose, but it caused some tests failing:

06:50 +8815 ~22: /b/s/w/ir/x/w/flutter/packages/flutter/test/material/scaffold_test.dart: Floating action button shrinks when bottom sheet becomes dominant                                            
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
A ValueNotifier<double> was used after being disposed.
Once you have called dispose() on a ValueNotifier<double>, it can no longer be used.

When the exception was thrown, this was the stack:
#0      ChangeNotifier.debugAssertNotDisposed.<anonymous closure> (package:flutter/src/foundation/change_notifier.dart:179:9)
#1      ChangeNotifier.debugAssertNotDisposed (package:flutter/src/foundation/change_notifier.dart:186:6)
#2      ChangeNotifier.dispose (package:flutter/src/foundation/change_notifier.dart:375:27)
#3      _DraggableSheetExtent.dispose (package:flutter/src/widgets/draggable_scrollable_sheet.dart:609:18)
#4      _DraggableScrollableSheetState.dispose (package:flutter/src/widgets/draggable_scrollable_sheet.dart:723:13)
#5      StatefulElement.unmount (package:flutter/src/widgets/framework.dart:5669:11)
#6      _InactiveElements._unmount (package:flutter/src/widgets/framework.dart:2056:13)
#7      _InactiveElements._unmount.<anonymous closure> (package:flutter/src/widgets/framework.dart:2054:7)
#8      ComponentElement.visitChildren (package:flutter/src/widgets/framework.dart:5512:14)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: leak trackingIssues and PRs related to memory leaks detected by leak_trackerframeworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions