diff --git a/examples/lib/stories/games/trex/obstacle/obstacle_type.dart b/examples/lib/stories/games/trex/obstacle/obstacle_type.dart index 84b0f7a6eda..0bc5d4e0a38 100644 --- a/examples/lib/stories/games/trex/obstacle/obstacle_type.dart +++ b/examples/lib/stories/games/trex/obstacle/obstacle_type.dart @@ -1,3 +1,5 @@ +// ignore_for_file: unused_element + import 'dart:ui'; import 'package:flame/collisions.dart'; diff --git a/examples/pubspec.yaml b/examples/pubspec.yaml index 319ce4440b5..4be229276d6 100644 --- a/examples/pubspec.yaml +++ b/examples/pubspec.yaml @@ -6,8 +6,8 @@ publish_to: 'none' version: 0.1.0 environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame/example/pubspec.yaml b/packages/flame/example/pubspec.yaml index 4bce9fefeca..62091c04411 100644 --- a/packages/flame/example/pubspec.yaml +++ b/packages/flame/example/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.0 publish_to: 'none' environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: diff --git a/packages/flame/lib/src/game/game_render_box.dart b/packages/flame/lib/src/game/game_render_box.dart index 09f48dd0c5f..c52d77e612e 100644 --- a/packages/flame/lib/src/game/game_render_box.dart +++ b/packages/flame/lib/src/game/game_render_box.dart @@ -3,6 +3,7 @@ import 'package:flutter/widgets.dart' hide WidgetBuilder; import 'game_loop.dart'; import 'mixins/game.dart'; +//ignore_for_file: unnecessary_non_null_assertion class GameRenderBox extends RenderBox with WidgetsBindingObserver { BuildContext buildContext; diff --git a/packages/flame/lib/src/game/game_widget/game_widget.dart b/packages/flame/lib/src/game/game_widget/game_widget.dart index 38a353046fc..b6b52901616 100644 --- a/packages/flame/lib/src/game/game_widget/game_widget.dart +++ b/packages/flame/lib/src/game/game_widget/game_widget.dart @@ -49,7 +49,7 @@ class GameWidget extends StatefulWidget { /// A map to show widgets overlay. /// /// See also: - /// - [new GameWidget] + /// - [GameWidget] /// - [Game.overlays] final Map>? overlayBuilderMap; @@ -58,7 +58,7 @@ class GameWidget extends StatefulWidget { /// To control the overlays that are active use [Game.overlays]. /// /// See also: - /// - [new GameWidget] + /// - [GameWidget] /// - [Game.overlays] final List? initialActiveOverlays; diff --git a/packages/flame/lib/src/game/game_widget/gestures.dart b/packages/flame/lib/src/game/game_widget/gestures.dart index 78a005f5f42..8eeba5b65ca 100644 --- a/packages/flame/lib/src/game/game_widget/gestures.dart +++ b/packages/flame/lib/src/game/game_widget/gestures.dart @@ -193,7 +193,7 @@ Widget applyAdvancedGesturesDetectors(Game game, Widget child) { if (game is MultiTapListener) { addRecognizer( - () => MultiTapGestureRecognizer(), + MultiTapGestureRecognizer.new, (MultiTapGestureRecognizer instance) { final g = game as MultiTapListener; instance.longTapDelay = Duration( @@ -210,7 +210,7 @@ Widget applyAdvancedGesturesDetectors(Game game, Widget child) { void addDragRecognizer(Drag Function(int, DragStartInfo) config) { addRecognizer( - () => ImmediateMultiDragGestureRecognizer(), + ImmediateMultiDragGestureRecognizer.new, (ImmediateMultiDragGestureRecognizer instance) { var lastGeneratedDragId = 0; instance.onStart = (Offset o) { diff --git a/packages/flame/lib/src/text.dart b/packages/flame/lib/src/text.dart index 6b6259368e0..01369efb4eb 100644 --- a/packages/flame/lib/src/text.dart +++ b/packages/flame/lib/src/text.dart @@ -18,8 +18,8 @@ abstract class TextRenderer { /// If you add a new [TextRenderer] child, you can register it by adding it, /// together with a provider lambda, to this map. static Map defaultRenderersRegistry = { - TextRenderer: () => TextPaint(), - TextPaint: () => TextPaint(), + TextRenderer: TextPaint.new, + TextPaint: TextPaint.new, }; final TextDirection textDirection; diff --git a/packages/flame/lib/src/widgets/nine_tile_box.dart b/packages/flame/lib/src/widgets/nine_tile_box.dart index 5aa2c895cf0..10564dc3638 100644 --- a/packages/flame/lib/src/widgets/nine_tile_box.dart +++ b/packages/flame/lib/src/widgets/nine_tile_box.dart @@ -53,6 +53,8 @@ class NineTileBoxWidget extends StatelessWidget { final Widget? child; + final EdgeInsetsGeometry? padding; + /// A builder function that is called if the loading fails final WidgetBuilder? errorBuilder; @@ -66,6 +68,7 @@ class NineTileBoxWidget extends StatelessWidget { this.width, this.height, this.child, + this.padding, this.errorBuilder, this.loadingBuilder, Key? key, @@ -80,6 +83,7 @@ class NineTileBoxWidget extends StatelessWidget { this.width, this.height, this.child, + this.padding, this.errorBuilder, this.loadingBuilder, Key? key, @@ -98,6 +102,7 @@ class NineTileBoxWidget extends StatelessWidget { width: width, height: height, child: child, + padding: padding, ); }, errorBuilder: errorBuilder, diff --git a/packages/flame/pubspec.yaml b/packages/flame/pubspec.yaml index 4c84f2221ef..a0fbdc3121b 100644 --- a/packages/flame/pubspec.yaml +++ b/packages/flame/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.1.1 homepage: https://github.com/flame-engine/flame environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/packages/flame/test/collisions/collision_test_helpers.dart b/packages/flame/test/collisions/collision_test_helpers.dart index d5e11270e99..0a0d1455232 100644 --- a/packages/flame/test/collisions/collision_test_helpers.dart +++ b/packages/flame/test/collisions/collision_test_helpers.dart @@ -11,7 +11,7 @@ Future testCollidableGame( String testName, Future Function(HasCollidablesGame) testBody, ) { - return testWithGame(testName, () => HasCollidablesGame(), testBody); + return testWithGame(testName, HasCollidablesGame.new, testBody); } class TestHitbox extends RectangleHitbox { diff --git a/packages/flame/test/components/component_test.dart b/packages/flame/test/components/component_test.dart index 4909114dd59..7cd347438d9 100644 --- a/packages/flame/test/components/component_test.dart +++ b/packages/flame/test/components/component_test.dart @@ -34,7 +34,7 @@ class _ParentOnPrepareComponent extends _OnPrepareComponent { } void main() { - final prepareGame = FlameTester(() => _PrepareGame()); + final prepareGame = FlameTester(_PrepareGame.new); group('Component', () { testWithFlameGame('children in the constructor', (game) async { diff --git a/packages/flame/test/components/composed_component_test.dart b/packages/flame/test/components/composed_component_test.dart index d81f1dfa641..2d56ac1b198 100644 --- a/packages/flame/test/components/composed_component_test.dart +++ b/packages/flame/test/components/composed_component_test.dart @@ -49,7 +49,7 @@ class _MyAsyncChild extends PositionComponent { void main() { final size = Vector2.all(300); - final withTappables = FlameTester(() => _HasTappablesGame()); + final withTappables = FlameTester(_HasTappablesGame.new); group('Composability', () { testWithFlameGame( diff --git a/packages/flame/test/components/draggable_test.dart b/packages/flame/test/components/draggable_test.dart index de4ae5e67e0..60c48c3536f 100644 --- a/packages/flame/test/components/draggable_test.dart +++ b/packages/flame/test/components/draggable_test.dart @@ -25,7 +25,7 @@ class _DraggableComponent extends PositionComponent with Draggable { } void main() { - final withDraggables = FlameTester(() => _GameHasDraggables()); + final withDraggables = FlameTester(_GameHasDraggables.new); group('Draggables', () { withDraggables.test( diff --git a/packages/flame/test/components/has_game_ref_test.dart b/packages/flame/test/components/has_game_ref_test.dart index 61620957b4e..c5e98c1b49f 100644 --- a/packages/flame/test/components/has_game_ref_test.dart +++ b/packages/flame/test/components/has_game_ref_test.dart @@ -22,7 +22,7 @@ class _BarComponent extends Component with HasGameRef<_MyGame> {} class MockFlameGame extends Mock implements _MyGame {} void main() { - final withHasGameRef = FlameTester(() => _MyGame()); + final withHasGameRef = FlameTester(_MyGame.new); group('HasGameRef', () { withHasGameRef.test('simple test', (game) { diff --git a/packages/flame/test/components/hoverable_test.dart b/packages/flame/test/components/hoverable_test.dart index bb5f3f33f97..a4bd13af0ec 100644 --- a/packages/flame/test/components/hoverable_test.dart +++ b/packages/flame/test/components/hoverable_test.dart @@ -41,7 +41,7 @@ class _NonPropagatingComponent extends _HoverableComponent { } void main() { - final withHoverables = FlameTester(() => _GameWithHoverables()); + final withHoverables = FlameTester(_GameWithHoverables.new); group('Hoverable', () { withHoverables.test( diff --git a/packages/flame/test/components/joystick_component_test.dart b/packages/flame/test/components/joystick_component_test.dart index 77780750460..0dc534b2605 100644 --- a/packages/flame/test/components/joystick_component_test.dart +++ b/packages/flame/test/components/joystick_component_test.dart @@ -8,7 +8,7 @@ import 'package:test/test.dart'; class _GameHasDraggables extends FlameGame with HasDraggables {} void main() { - final withDraggables = FlameTester(() => _GameHasDraggables()); + final withDraggables = FlameTester(_GameHasDraggables.new); group('JoystickDirection tests', () { withDraggables.test('can convert angle to JoystickDirection', (game) async { diff --git a/packages/flame/test/components/parallax_test.dart b/packages/flame/test/components/parallax_test.dart index 85eb097ee93..8dde0c6cf5d 100644 --- a/packages/flame/test/components/parallax_test.dart +++ b/packages/flame/test/components/parallax_test.dart @@ -80,8 +80,8 @@ class _SlowLoadParallaxGame extends FlameGame { } void main() { - final parallaxGame = FlameTester(() => _ParallaxGame()); - final slowLoadParallaxGame = FlameTester(() => _SlowLoadParallaxGame()); + final parallaxGame = FlameTester(_ParallaxGame.new); + final slowLoadParallaxGame = FlameTester(_SlowLoadParallaxGame.new); group('parallax test', () { parallaxGame.test( diff --git a/packages/flame/test/components/priority_test.dart b/packages/flame/test/components/priority_test.dart index 41c26e64045..303c20da603 100644 --- a/packages/flame/test/components/priority_test.dart +++ b/packages/flame/test/components/priority_test.dart @@ -33,8 +33,7 @@ void main() { flameGame.test( 'components with different priorities are sorted in the list', (game) async { - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)); + final priorityComponents = List.generate(10, _PriorityComponent.new); priorityComponents.shuffle(); await game.ensureAddAll(priorityComponents); componentsSorted(game.children); @@ -45,9 +44,8 @@ void main() { 'changing priority should reorder component list', (game) async { final firstComponent = _PriorityComponent(-1); - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)) - ..add(firstComponent); + final priorityComponents = List.generate(10, _PriorityComponent.new) + ..add(firstComponent); priorityComponents.shuffle(); final components = game.children; await game.ensureAddAll(priorityComponents); @@ -63,9 +61,8 @@ void main() { 'changing priority with the priority setter should reorder the list', (game) async { final firstComponent = _PriorityComponent(-1); - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)) - ..add(firstComponent); + final priorityComponents = List.generate(10, _PriorityComponent.new) + ..add(firstComponent); priorityComponents.shuffle(); final components = game.children; await game.ensureAddAll(priorityComponents); @@ -80,8 +77,7 @@ void main() { flameGame.test( 'changing priorities should reorder component list', (game) async { - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)); + final priorityComponents = List.generate(10, _PriorityComponent.new); priorityComponents.shuffle(); final components = game.children; await game.ensureAddAll(priorityComponents); @@ -102,8 +98,7 @@ void main() { 'changing child priority should reorder component list', (game) async { final parentComponent = _PriorityComponent(0); - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)); + final priorityComponents = List.generate(10, _PriorityComponent.new); priorityComponents.shuffle(); await game.ensureAdd(parentComponent); await parentComponent.ensureAddAll(priorityComponents); @@ -121,8 +116,7 @@ void main() { 'changing child priorities should reorder component list', (game) async { final parentComponent = _PriorityComponent(0); - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)); + final priorityComponents = List.generate(10, _PriorityComponent.new); priorityComponents.shuffle(); await game.ensureAdd(parentComponent); await parentComponent.ensureAddAll(priorityComponents); @@ -145,8 +139,7 @@ void main() { (game) async { final grandParentComponent = _PriorityComponent(0); final parentComponent = _PriorityComponent(0); - final priorityComponents = - List.generate(10, (i) => _PriorityComponent(i)); + final priorityComponents = List.generate(10, _PriorityComponent.new); priorityComponents.shuffle(); await game.ensureAdd(grandParentComponent); await grandParentComponent.ensureAdd(parentComponent); diff --git a/packages/flame/test/components/timer_component_test.dart b/packages/flame/test/components/timer_component_test.dart index 248cc39a9dd..b682cb913bf 100644 --- a/packages/flame/test/components/timer_component_test.dart +++ b/packages/flame/test/components/timer_component_test.dart @@ -30,7 +30,7 @@ class _NonRepeatingTimerComponent extends TimerComponent { void main() { group('TimerComponent', () { - final tester = FlameTester(() => FlameGame()); + final tester = FlameTester(FlameGame.new); tester.test('runs the tick method', (game) { final timer = _MyTimerComponent(); diff --git a/packages/flame/test/effects/controllers/effect_controller_test.dart b/packages/flame/test/effects/controllers/effect_controller_test.dart index aa9905a95d7..a64b95fc210 100644 --- a/packages/flame/test/effects/controllers/effect_controller_test.dart +++ b/packages/flame/test/effects/controllers/effect_controller_test.dart @@ -315,7 +315,7 @@ void main() { group('errors', () { test('empty', () { expect( - () => EffectController(), + EffectController.new, failsAssert('Either duration or speed must be specified'), ); }); diff --git a/packages/flame/test/experimental/fixed_size_viewport_test.dart b/packages/flame/test/experimental/fixed_size_viewport_test.dart index 8baab8e26a3..1ec6df85104 100644 --- a/packages/flame/test/experimental/fixed_size_viewport_test.dart +++ b/packages/flame/test/experimental/fixed_size_viewport_test.dart @@ -46,7 +46,7 @@ void main() { expect(viewport.containsLocalPoint(Vector2(300, 100)), true); }); - FlameTester(() => FlameGame()).testGameWidget( + FlameTester(FlameGame.new).testGameWidget( 'Clipping behavior', setUp: (game, tester) async { final world = World(); diff --git a/packages/flame/test/game/flame_game_test.dart b/packages/flame/test/game/flame_game_test.dart index 4b02c84b5e9..da38c2a6495 100644 --- a/packages/flame/test/game/flame_game_test.dart +++ b/packages/flame/test/game/flame_game_test.dart @@ -5,6 +5,7 @@ import 'package:flame_test/flame_test.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; import 'package:flutter_test/flutter_test.dart'; + import 'projector_test.dart'; void main() { @@ -42,7 +43,7 @@ void main() { testWithGame<_GameWithTappables>( 'Add component with onLoad function', - () => _GameWithTappables(), + _GameWithTappables.new, (game) async { final component = _MyAsyncComponent(); await game.ensureAdd(component); @@ -66,7 +67,7 @@ void main() { testWithGame<_GameWithTappables>( 'component can be tapped', - () => _GameWithTappables(), + _GameWithTappables.new, (game) async { final component = _MyTappableComponent(); await game.ensureAdd(component); diff --git a/packages/flame/test/game/game_widget/game_widget_drag_test.dart b/packages/flame/test/game/game_widget/game_widget_drag_test.dart index 0fc348e00cb..326ab00c8e2 100644 --- a/packages/flame/test/game/game_widget/game_widget_drag_test.dart +++ b/packages/flame/test/game/game_widget/game_widget_drag_test.dart @@ -49,9 +49,9 @@ class _PanGame extends FlameGame with PanDetector { } void main() { - final horizontalGame = FlameTester(() => _HorizontalDragGame()); - final verticalGame = FlameTester(() => _VerticalDragGame()); - final panGame = FlameTester(() => _PanGame()); + final horizontalGame = FlameTester(_HorizontalDragGame.new); + final verticalGame = FlameTester(_VerticalDragGame.new); + final panGame = FlameTester(_PanGame.new); group('GameWidget - HorizontalDragDetector', () { horizontalGame.testGameWidget( diff --git a/packages/flame/test/game/game_widget/game_widget_pause_test.dart b/packages/flame/test/game/game_widget/game_widget_pause_test.dart index b54adbdebcb..06e4e44d2a5 100644 --- a/packages/flame/test/game/game_widget/game_widget_pause_test.dart +++ b/packages/flame/test/game/game_widget/game_widget_pause_test.dart @@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; class _Wrapper extends StatefulWidget { const _Wrapper({ required this.child, + // ignore: unused_element this.small = false, }); diff --git a/packages/flame/test/game/game_widget/game_widget_tap_test.dart b/packages/flame/test/game/game_widget/game_widget_tap_test.dart index 76185fcaec4..245087de3b2 100644 --- a/packages/flame/test/game/game_widget/game_widget_tap_test.dart +++ b/packages/flame/test/game/game_widget/game_widget_tap_test.dart @@ -29,8 +29,8 @@ class _DoubleTapGame extends FlameGame with DoubleTapDetector { } void main() { - final tapGame = FlameTester(() => _TapGame()); - final doubleTapGame = FlameTester(() => _DoubleTapGame()); + final tapGame = FlameTester(_TapGame.new); + final doubleTapGame = FlameTester(_DoubleTapGame.new); group('GameWidget - TapDetectors', () { tapGame.testGameWidget( diff --git a/packages/flame/test/game/game_widget/game_widget_test.dart b/packages/flame/test/game/game_widget/game_widget_test.dart index fe31e78cd70..faa381fad01 100644 --- a/packages/flame/test/game/game_widget/game_widget_test.dart +++ b/packages/flame/test/game/game_widget/game_widget_test.dart @@ -67,7 +67,7 @@ class _MyGame extends FlameGame { FlameTester<_MyGame> myGame({required bool open}) { return FlameTester( - () => _MyGame(), + _MyGame.new, pumpWidget: (gameWidget, tester) async { await tester.pumpWidget(_Wrapper(child: gameWidget, open: open)); }, diff --git a/packages/flame/test/game/mixins/has_draggables_test.dart b/packages/flame/test/game/mixins/has_draggables_test.dart index 973e3996534..4e0dcb836a8 100644 --- a/packages/flame/test/game/mixins/has_draggables_test.dart +++ b/packages/flame/test/game/mixins/has_draggables_test.dart @@ -56,7 +56,7 @@ class _DraggableComponent extends PositionComponent with Draggable { } void main() { - final withDraggables = FlameTester(() => _GameWithDraggables()); + final withDraggables = FlameTester(_GameWithDraggables.new); group('HasDraggables', () { withDraggables.test( diff --git a/packages/flame/test/game/mixins/has_tappables_test.dart b/packages/flame/test/game/mixins/has_tappables_test.dart index d9e37887c8f..e3c4ce6dcf6 100644 --- a/packages/flame/test/game/mixins/has_tappables_test.dart +++ b/packages/flame/test/game/mixins/has_tappables_test.dart @@ -71,7 +71,7 @@ class _TappableComponent extends PositionComponent with Tappable { } void main() { - final withTappables = FlameTester(() => _GameWithTappables()); + final withTappables = FlameTester(_GameWithTappables.new); group('HasTappables', () { withTappables.test( diff --git a/packages/flame/test/game/mixins/single_game_instance_test.dart b/packages/flame/test/game/mixins/single_game_instance_test.dart index 182a7deb34a..c80120fa0c3 100644 --- a/packages/flame/test/game/mixins/single_game_instance_test.dart +++ b/packages/flame/test/game/mixins/single_game_instance_test.dart @@ -18,7 +18,7 @@ void main() { ..onGameResize(Vector2.all(100)) ..onMount(); expect( - () => FlameGame(), + FlameGame.new, failsAssert( "Instance of 'FlameGame' instantiated, while another game " "Instance of 'SingletonGame' declares itself to be a singleton", diff --git a/packages/flame/test/sprite_test.dart b/packages/flame/test/sprite_test.dart index 22d5a302014..03db73d2871 100644 --- a/packages/flame/test/sprite_test.dart +++ b/packages/flame/test/sprite_test.dart @@ -10,7 +10,7 @@ import '_resources/load_image.dart'; void main() { group('Sprite', () { - FlameTester(() => FlameGame()).testGameWidget( + FlameTester(FlameGame.new).testGameWidget( 'Render with anchor', setUp: (game, tester) async { game.add(MyComponent()..position = Vector2.all(25)); diff --git a/packages/flame/test/text_test.dart b/packages/flame/test/text_test.dart index 05340f8576d..acc34871848 100644 --- a/packages/flame/test/text_test.dart +++ b/packages/flame/test/text_test.dart @@ -44,7 +44,7 @@ void main() { test('custom renderer', () { TextRenderer.defaultRenderersRegistry[_CustomTextRenderer] = - () => _CustomTextRenderer(); + _CustomTextRenderer.new; final tc = TextComponent<_CustomTextRenderer>(text: 'foo'); expect(tc.textRenderer, isA<_CustomTextRenderer>()); }); diff --git a/packages/flame_audio/example/pubspec.yaml b/packages/flame_audio/example/pubspec.yaml index 4034d7b35a9..9b5aa8a1dba 100644 --- a/packages/flame_audio/example/pubspec.yaml +++ b/packages/flame_audio/example/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flame: diff --git a/packages/flame_audio/lib/bgm.dart b/packages/flame_audio/lib/bgm.dart index 6fb3518a35f..ea6a8c62f73 100644 --- a/packages/flame_audio/lib/bgm.dart +++ b/packages/flame_audio/lib/bgm.dart @@ -3,6 +3,8 @@ import 'dart:io'; import 'package:audioplayers/audioplayers.dart'; import 'package:flutter/widgets.dart'; +//ignore_for_file: invalid_null_aware_operator + /// {@template _bgm} /// The looping background music class. /// diff --git a/packages/flame_audio/pubspec.yaml b/packages/flame_audio/pubspec.yaml index 782c131caef..f1aa6fbbe92 100644 --- a/packages/flame_audio/pubspec.yaml +++ b/packages/flame_audio/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.2 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_audio environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_bloc/example/pubspec.yaml b/packages/flame_bloc/example/pubspec.yaml index 4929c99ce60..b72c7d01275 100644 --- a/packages/flame_bloc/example/pubspec.yaml +++ b/packages/flame_bloc/example/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flutter: diff --git a/packages/flame_bloc/pubspec.yaml b/packages/flame_bloc/pubspec.yaml index 052f7bdfa58..74667837739 100644 --- a/packages/flame_bloc/pubspec.yaml +++ b/packages/flame_bloc/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.4.0 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_bloc environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/packages/flame_bloc/test/flame_bloc_game_test.dart b/packages/flame_bloc/test/flame_bloc_game_test.dart index c129d2c9c2d..59f02707405 100644 --- a/packages/flame_bloc/test/flame_bloc_game_test.dart +++ b/packages/flame_bloc/test/flame_bloc_game_test.dart @@ -47,7 +47,7 @@ void main() { }); final blocGame = FlameTester( - () => MyBlocGame(), + MyBlocGame.new, pumpWidget: (gameWidget, tester) async { await tester.pumpWidget( BlocProvider.value( diff --git a/packages/flame_bloc/test/src/flame_bloc_provider_test.dart b/packages/flame_bloc/test/src/flame_bloc_provider_test.dart index 38f446631bf..23af7a1e3eb 100644 --- a/packages/flame_bloc/test/src/flame_bloc_provider_test.dart +++ b/packages/flame_bloc/test/src/flame_bloc_provider_test.dart @@ -87,7 +87,7 @@ void main() { group('onRemove', () { testWithFlameGame('dispose created blocs', (game) async { final provider = FlameBlocProvider( - create: () => InventoryCubit(), + create: InventoryCubit.new, ); await game.ensureAdd(provider); expect(provider.bloc.isClosed, isFalse); diff --git a/packages/flame_fire_atlas/example/pubspec.yaml b/packages/flame_fire_atlas/example/pubspec.yaml index 5831aee5001..5a0e78e5fcc 100644 --- a/packages/flame_fire_atlas/example/pubspec.yaml +++ b/packages/flame_fire_atlas/example/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flutter: diff --git a/packages/flame_fire_atlas/pubspec.yaml b/packages/flame_fire_atlas/pubspec.yaml index b8872234752..fb85a9a69ee 100644 --- a/packages/flame_fire_atlas/pubspec.yaml +++ b/packages/flame_fire_atlas/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.0.2 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_fire_atlas environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/packages/flame_flare/example/pubspec.yaml b/packages/flame_flare/example/pubspec.yaml index 63a2d09dcf6..5b96d7968be 100644 --- a/packages/flame_flare/example/pubspec.yaml +++ b/packages/flame_flare/example/pubspec.yaml @@ -4,8 +4,8 @@ publish_to: 'none' version: 0.1.0 environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: diff --git a/packages/flame_flare/pubspec.yaml b/packages/flame_flare/pubspec.yaml index a1f36bc6ed0..07e2b9ba403 100644 --- a/packages/flame_flare/pubspec.yaml +++ b/packages/flame_flare/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.1.1 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_flare environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_forge2d/example/pubspec.yaml b/packages/flame_forge2d/example/pubspec.yaml index aa39cc2242d..fb7aee37319 100644 --- a/packages/flame_forge2d/example/pubspec.yaml +++ b/packages/flame_forge2d/example/pubspec.yaml @@ -6,8 +6,8 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/packages/flame_forge2d/pubspec.yaml b/packages/flame_forge2d/pubspec.yaml index b2249c43e20..96e1769a9fb 100644 --- a/packages/flame_forge2d/pubspec.yaml +++ b/packages/flame_forge2d/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.11.0 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_forge2d environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_lint/pubspec.yaml b/packages/flame_lint/pubspec.yaml index 54017b797db..30452523bd0 100644 --- a/packages/flame_lint/pubspec.yaml +++ b/packages/flame_lint/pubspec.yaml @@ -5,7 +5,7 @@ homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_lint publish_to: 'none' environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dev_dependencies: dartdoc: ^4.1.0 diff --git a/packages/flame_oxygen/example/lib/main.dart b/packages/flame_oxygen/example/lib/main.dart index 7b01c8f31e1..0e6d064ae71 100644 --- a/packages/flame_oxygen/example/lib/main.dart +++ b/packages/flame_oxygen/example/lib/main.dart @@ -26,9 +26,9 @@ class ExampleGame extends OxygenGame { world.registerSystem(SpriteSystem()); world.registerSystem(KawabungaSystem()); - world.registerComponent(() => TimerComponent()); + world.registerComponent(TimerComponent.new); world.registerComponent( - () => VelocityComponent(), + VelocityComponent.new, ); final random = Random(); diff --git a/packages/flame_oxygen/example/pubspec.yaml b/packages/flame_oxygen/example/pubspec.yaml index b6da09d8b18..3f26d161b27 100644 --- a/packages/flame_oxygen/example/pubspec.yaml +++ b/packages/flame_oxygen/example/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flutter: diff --git a/packages/flame_oxygen/lib/src/oxygen_game.dart b/packages/flame_oxygen/lib/src/oxygen_game.dart index ef8665b14b2..198ccc8f145 100644 --- a/packages/flame_oxygen/lib/src/oxygen_game.dart +++ b/packages/flame_oxygen/lib/src/oxygen_game.dart @@ -41,17 +41,17 @@ abstract class OxygenGame with Game { @mustCallSuper Future onLoad() async { // Registering default components. - world.registerComponent(() => SizeComponent()); + world.registerComponent(SizeComponent.new); world.registerComponent( - () => PositionComponent(), + PositionComponent.new, ); - world.registerComponent(() => AngleComponent()); - world.registerComponent(() => AnchorComponent()); + world.registerComponent(AngleComponent.new); + world.registerComponent(AnchorComponent.new); world.registerComponent( - () => SpriteComponent(), + SpriteComponent.new, ); - world.registerComponent(() => TextComponent()); - world.registerComponent(() => FlipComponent()); + world.registerComponent(TextComponent.new); + world.registerComponent(FlipComponent.new); await init(); world.init(); diff --git a/packages/flame_oxygen/pubspec.yaml b/packages/flame_oxygen/pubspec.yaml index 49367c37e89..de7d4a16a39 100644 --- a/packages/flame_oxygen/pubspec.yaml +++ b/packages/flame_oxygen/pubspec.yaml @@ -4,8 +4,8 @@ version: 0.1.2 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_oxygen environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flutter: diff --git a/packages/flame_rive/example/pubspec.yaml b/packages/flame_rive/example/pubspec.yaml index cffc6c77822..5e907be7a36 100644 --- a/packages/flame_rive/example/pubspec.yaml +++ b/packages/flame_rive/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: rive: 0.8.4 diff --git a/packages/flame_rive/pubspec.yaml b/packages/flame_rive/pubspec.yaml index 5afb8f098fd..8d26b9d1bd0 100644 --- a/packages/flame_rive/pubspec.yaml +++ b/packages/flame_rive/pubspec.yaml @@ -4,8 +4,8 @@ homepage: https://github.com/flame-engine/flame version: 1.2.0 environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_svg/example/pubspec.yaml b/packages/flame_svg/example/pubspec.yaml index fa816509ac8..c180df52dc4 100644 --- a/packages/flame_svg/example/pubspec.yaml +++ b/packages/flame_svg/example/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flutter: diff --git a/packages/flame_svg/pubspec.yaml b/packages/flame_svg/pubspec.yaml index 75e488a689b..60b21eb8518 100644 --- a/packages/flame_svg/pubspec.yaml +++ b/packages/flame_svg/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.2.0 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_svg environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_test/example/pubspec.yaml b/packages/flame_test/example/pubspec.yaml index e505893c531..4fb6ff340dd 100644 --- a/packages/flame_test/example/pubspec.yaml +++ b/packages/flame_test/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flutter: diff --git a/packages/flame_test/example/test/flame_test_test.dart b/packages/flame_test/example/test/flame_test_test.dart index f0184051743..59c91b92d73 100644 --- a/packages/flame_test/example/test/flame_test_test.dart +++ b/packages/flame_test/example/test/flame_test_test.dart @@ -2,7 +2,7 @@ import 'package:flame_test/flame_test.dart'; import 'package:flame_test_example/game.dart'; import 'package:flutter_test/flutter_test.dart'; -final myGame = FlameTester(() => MyGame()); +final myGame = FlameTester(MyGame.new); void main() { group('flameTest', () { TestWidgetsFlutterBinding.ensureInitialized(); diff --git a/packages/flame_test/lib/src/flame_test.dart b/packages/flame_test/lib/src/flame_test.dart index c8c442eeeeb..596ec6ce632 100644 --- a/packages/flame_test/lib/src/flame_test.dart +++ b/packages/flame_test/lib/src/flame_test.dart @@ -201,4 +201,4 @@ class FlameTester extends GameTester { /// Default instance of Flame Tester to be used when you don't care about /// changing any configuration. -final flameGame = FlameTester(() => FlameGame()); +final flameGame = FlameTester(FlameGame.new); diff --git a/packages/flame_test/lib/src/test_flame_game.dart b/packages/flame_test/lib/src/test_flame_game.dart index 186f64da7b9..c66c347f222 100644 --- a/packages/flame_test/lib/src/test_flame_game.dart +++ b/packages/flame_test/lib/src/test_flame_game.dart @@ -28,7 +28,7 @@ Future testWithFlameGame( String testName, AsyncGameFunction testBody, ) { - return testWithGame(testName, () => FlameGame(), testBody); + return testWithGame(testName, FlameGame.new, testBody); } /// Utility function for writing tests that require a custom game instance. diff --git a/packages/flame_test/pubspec.yaml b/packages/flame_test/pubspec.yaml index 6a24a65898b..a35eb73d676 100644 --- a/packages/flame_test/pubspec.yaml +++ b/packages/flame_test/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.4.0 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_test environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_test/test/golden_test.dart b/packages/flame_test/test/golden_test.dart index 28fea4cfa95..deaed000d2f 100644 --- a/packages/flame_test/test/golden_test.dart +++ b/packages/flame_test/test/golden_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart'; void main() { group('Golden tests', () { - final tester = FlameTester(() => FlameGame()); + final tester = FlameTester(FlameGame.new); tester.testGameWidget( 'renders correctly', diff --git a/packages/flame_test/test/test_with_game_test.dart b/packages/flame_test/test/test_with_game_test.dart index 88a72a2315a..8d188ba20b1 100644 --- a/packages/flame_test/test/test_with_game_test.dart +++ b/packages/flame_test/test/test_with_game_test.dart @@ -18,7 +18,7 @@ void main() { testWithGame( 'correct event sequence', - () => RecordedGame(), + RecordedGame.new, (game) async { var events = []; events = game.events; diff --git a/packages/flame_tiled/example/pubspec.yaml b/packages/flame_tiled/example/pubspec.yaml index 1342a3a2335..0a4828d7ac3 100644 --- a/packages/flame_tiled/example/pubspec.yaml +++ b/packages/flame_tiled/example/pubspec.yaml @@ -4,7 +4,7 @@ publish_to: 'none' version: 1.0.0+1 environment: - sdk: ">=2.14.0 <3.0.0" + sdk: ">=2.16.0 <3.0.0" dependencies: flame: ^1.1.1 diff --git a/packages/flame_tiled/pubspec.yaml b/packages/flame_tiled/pubspec.yaml index a7ade2bb674..0189d6b00e4 100644 --- a/packages/flame_tiled/pubspec.yaml +++ b/packages/flame_tiled/pubspec.yaml @@ -4,8 +4,8 @@ version: 1.4.0 homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_tiled environment: - sdk: ">=2.14.0 <3.0.0" - flutter: ">=2.5.0" + sdk: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" dependencies: flame: ^1.1.1