From 7ca345de69756350f844d63f7b060fbfdae07cd1 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Sat, 15 Jul 2023 08:37:09 +0200 Subject: [PATCH] neon_news,neon_notes: Do not await wakelock operations --- packages/neon/neon_news/lib/pages/article.dart | 6 +++--- packages/neon/neon_notes/lib/pages/note.dart | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/neon/neon_news/lib/pages/article.dart b/packages/neon/neon_news/lib/pages/article.dart index 1aaf4766..d6413630 100644 --- a/packages/neon/neon_news/lib/pages/article.dart +++ b/packages/neon/neon_news/lib/pages/article.dart @@ -33,9 +33,9 @@ class _NewsArticlePageState extends State { NeonException.showSnackbar(context, error); }); - WidgetsBinding.instance.addPostFrameCallback((final _) async { + WidgetsBinding.instance.addPostFrameCallback((final _) { if (Provider.of(context, listen: false).canUseWakelock) { - await WakelockPlus.enable(); + unawaited(WakelockPlus.enable()); } }); @@ -103,7 +103,7 @@ class _NewsArticlePageState extends State { } if (mounted && Provider.of(context, listen: false).canUseWakelock) { - await WakelockPlus.disable(); + unawaited(WakelockPlus.disable()); } return false; }, diff --git a/packages/neon/neon_notes/lib/pages/note.dart b/packages/neon/neon_notes/lib/pages/note.dart index 06e40bdc..9a247d50 100644 --- a/packages/neon/neon_notes/lib/pages/note.dart +++ b/packages/neon/neon_notes/lib/pages/note.dart @@ -41,9 +41,9 @@ class _NotesNotePageState extends State { _contentController.addListener(() => _contentStreamController.add(_contentController.text)); _titleController.addListener(() => _titleStreamController.add(_titleController.text)); - WidgetsBinding.instance.addPostFrameCallback((final _) async { + WidgetsBinding.instance.addPostFrameCallback((final _) { if (Provider.of(context, listen: false).canUseWakelock) { - await WakelockPlus.enable(); + unawaited(WakelockPlus.enable()); } if (widget.bloc.options.defaultNoteViewTypeOption.value == DefaultNoteViewType.edit || widget.bloc.initialContent.isEmpty) { @@ -66,7 +66,7 @@ class _NotesNotePageState extends State { Widget build(final BuildContext context) => BackButtonListener( onBackButtonPressed: () async { if (Provider.of(context, listen: false).canUseWakelock) { - await WakelockPlus.disable(); + unawaited(WakelockPlus.disable()); } return false; },