From 7ac80a78e95b06bb1287fb74773634483d80b1c9 Mon Sep 17 00:00:00 2001 From: markvideon Date: Mon, 8 Jan 2024 03:39:56 +1030 Subject: [PATCH] fix: Change return type of RiverpodComponentMixin.onLoad to FutureOr (#2964) This PR changes the return type of RiverpodComponentMixin.onLoad to match that of Component.onLoad. This resolves #2961 which describes an error preventing use of RiverpodComponentMixin on Component subclasses that return a Future in their implementation of onLoad due to a signature mismatch. Closes #2961. --------- Co-authored-by: Lukas Klingsbo --- .github/.cspell/gamedev_dictionary.txt | 1 - packages/flame_riverpod/lib/src/consumer.dart | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/.cspell/gamedev_dictionary.txt b/.github/.cspell/gamedev_dictionary.txt index 91316a6449c..642d8737ef9 100644 --- a/.github/.cspell/gamedev_dictionary.txt +++ b/.github/.cspell/gamedev_dictionary.txt @@ -6,7 +6,6 @@ AHSV # alpha hue saturation value antialiasing # set of techniques to combat the problems of aliasing ARGB # alpha red green blue arities # plural of arity -arity # number of parameters a function takes autofocus # auto focus event backgrounded # moving the app to the background backgrounding # moving the app to the background diff --git a/packages/flame_riverpod/lib/src/consumer.dart b/packages/flame_riverpod/lib/src/consumer.dart index d55f826e8f0..838340740c9 100644 --- a/packages/flame_riverpod/lib/src/consumer.dart +++ b/packages/flame_riverpod/lib/src/consumer.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'package:flame/components.dart'; import 'package:flame/game.dart'; import 'package:flame_riverpod/src/widget.dart'; @@ -80,7 +81,7 @@ mixin RiverpodComponentMixin on Component { @mustCallSuper @override - void onLoad() { + FutureOr onLoad() { ref.game = findGame()! as RiverpodGameMixin; super.onLoad(); }