Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e33410c

Browse filesBrowse files
committed
Fix deprecated WidgetsBinding.window warning
1 parent 81c7833 commit e33410c
Copy full SHA for e33410c

File tree

Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-2
lines changed

‎packages/flutter_hooks/CHANGELOG.md

Copy file name to clipboardExpand all lines: packages/flutter_hooks/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Added `useSearchController` (thanks to @snapsl)
44
- Keys on `useCallback` are now optional, to match `useMemoized` (thanks to @jezsung)
5+
- Update `usePlatformBrightness` to stop relying on deprecated code
56

67
## 0.18.6
78

‎packages/flutter_hooks/lib/src/platform_brightness.dart

Copy file name to clipboardExpand all lines: packages/flutter_hooks/lib/src/platform_brightness.dart
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class _PlatformBrightnessState
4242
@override
4343
void initHook() {
4444
super.initHook();
45-
_brightness = WidgetsBinding.instance.window.platformBrightness;
45+
_brightness = WidgetsBinding.instance.platformDispatcher.platformBrightness;
4646
WidgetsBinding.instance.addObserver(this);
4747
}
4848

@@ -59,7 +59,7 @@ class _PlatformBrightnessState
5959
void didChangePlatformBrightness() {
6060
super.didChangePlatformBrightness();
6161
final _previous = _brightness;
62-
_brightness = WidgetsBinding.instance.window.platformBrightness;
62+
_brightness = WidgetsBinding.instance.platformDispatcher.platformBrightness;
6363
hook.onBrightnessChange?.call(_previous, _brightness);
6464

6565
if (hook.rebuildOnChange) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.