Skip to content

Commit

Permalink
fix: Solve warnings from 3.10.0 analyzer (#2532)
Browse files Browse the repository at this point in the history
Just solves the warnings that the new Flutter version complains about (which makes us lose 10 points on pub).
  • Loading branch information
spydon committed May 14, 2023
1 parent 7dd2bf7 commit b41622d
Show file tree
Hide file tree
Showing 73 changed files with 138 additions and 141 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/cicd.yml
Expand Up @@ -15,12 +15,10 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.7.1'
flutter-version: '3.10.0'
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@main
with:
melos-version: '3.0.0-dev.0'
- run: melos run format-check

analyze:
Expand All @@ -29,11 +27,9 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.7.1'
flutter-version: '3.10.0'
channel: 'stable'
- uses: bluefireteam/melos-action@v2
with:
melos-version: '3.0.0-dev.0'
- name: "Analyze"
uses: invertase/github-action-dart-analyzer@v1
with:
Expand All @@ -58,11 +54,9 @@ jobs:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.7.1'
flutter-version: '3.10.0'
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@main
with:
melos-version: '3.0.0-dev.0'
- uses: bluefireteam/spec-action@main
# END TESTING STAGE
2 changes: 1 addition & 1 deletion doc/flame/examples/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: none

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/klondike/app/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ version: 1.0.0
publish_to: none

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
flame: ^1.7.3
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/platformer/app/pubspec.yaml
Expand Up @@ -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.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
flame: ^1.7.3
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/space_shooter/app/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
flame: ^1.7.3
Expand Down
10 changes: 5 additions & 5 deletions examples/games/padracing/pubspec.yaml
@@ -1,19 +1,19 @@
name: padracing
description: A sample game featuring Flame and Forge2D for DartPad
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
collection: ^1.16.0
collection: ^1.17.1
flame: ^1.7.3
flame_forge2d: ^0.13.0+1
flutter:
sdk: flutter
google_fonts: ^2.3.2
url_launcher: ^6.1.2
google_fonts: ^4.0.4
url_launcher: ^6.1.11

dev_dependencies:
flame_lint: ^0.2.0+2
Expand Down
2 changes: 1 addition & 1 deletion examples/games/rogue_shooter/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 0.1.0

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion examples/games/trex/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 0.1.0

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
Expand Down
Expand Up @@ -18,7 +18,7 @@ class AnimationGroupExample extends FlameGame with TapDetector {
back to the original animation.
''';

late SpriteAnimationGroupComponent robot;
late SpriteAnimationGroupComponent<RobotState> robot;

@override
Future<void> onLoad() async {
Expand Down
Expand Up @@ -22,7 +22,7 @@ class SimpleIsolateExample extends FlameGame {
''';

@override
Future onLoad() async {
Future<void> onLoad() async {
camera.viewport = FixedResolutionViewport(Vector2(400, 600));

const rect = Rect.fromLTRB(80, 230, 320, 470);
Expand Down Expand Up @@ -86,7 +86,7 @@ class CalculatePrimeNumber extends PositionComponent
}

@override
Future onMount() {
Future<void> onMount() {
_interval = Timer(0.4, repeat: true, onTick: _checkNextAgainstPrime)
..start();
return super.onMount();
Expand All @@ -113,7 +113,7 @@ class CalculatePrimeNumber extends PositionComponent
_isPrime(_primeStartNumber),
);

Future _checkNextAgainstPrime() async {
Future<void> _checkNextAgainstPrime() async {
final nextInt = _primeData.key + 1;

try {
Expand Down
4 changes: 2 additions & 2 deletions examples/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: "none"
version: 0.1.0

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
Expand All @@ -22,7 +22,7 @@ dependencies:
flame_tiled: ^1.10.1
flutter:
sdk: flutter
google_fonts: ^2.3.2
google_fonts: ^4.0.4
meta: ^1.8.0
padracing: ^1.0.0
provider: ^6.0.5
Expand Down
2 changes: 1 addition & 1 deletion packages/flame/example/pubspec.yaml
Expand Up @@ -4,7 +4,7 @@ version: 0.1.0
publish_to: 'none'

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
Expand Down
2 changes: 1 addition & 1 deletion packages/flame/lib/src/cache/assets_cache.dart
Expand Up @@ -8,7 +8,7 @@ import 'package:flutter/services.dart' show rootBundle;
/// It automatically looks for files in the `assets` directory.
class AssetsCache {
final String prefix;
final Map<String, _Asset> _files = {};
final Map<String, _Asset<dynamic>> _files = {};

AssetsCache({this.prefix = 'assets/'});

Expand Down
3 changes: 1 addition & 2 deletions packages/flame/lib/src/components/core/recycled_queue.dart
@@ -1,4 +1,3 @@
import 'dart:collection';
import 'dart:math';

/// [RecycledQueue] is a simple FIFO queue where the elements are recycled.
Expand All @@ -20,7 +19,7 @@ import 'dart:math';
/// iterator is allowed at a time.
///
/// Internally, the queue is backed by a circular list.
class RecycledQueue<T extends Disposable> extends IterableMixin<T>
class RecycledQueue<T extends Disposable> extends Iterable<T>
implements Iterator<T> {
RecycledQueue(this.factory, {int initialCapacity = 8})
: _elements = List.generate(initialCapacity, (i) => factory()),
Expand Down
3 changes: 2 additions & 1 deletion packages/flame/lib/src/components/text_box_component.dart
Expand Up @@ -81,7 +81,8 @@ class TextBoxComponent<T extends TextRenderer> extends TextComponent {
}) : _boxConfig = boxConfig ?? TextBoxConfig(),
_fixedSize = size != null,
align = align ?? Anchor.topLeft,
pixelRatio = pixelRatio ?? window.devicePixelRatio;
pixelRatio = pixelRatio ??
PlatformDispatcher.instance.views.first.devicePixelRatio;

/// Alignment of the text within its bounding box.
///
Expand Down
2 changes: 1 addition & 1 deletion packages/flame/lib/src/game/game.dart
Expand Up @@ -19,7 +19,7 @@ import 'package:meta/meta.dart';
///
/// Methods [update] and [render] need to be implemented in order to connect
/// your class with the internal game loop.
abstract class Game {
abstract mixin class Game {
/// The cache of all images loaded into the game. This defaults to the global
/// [Flame.images] cache, but you can replace it with a new cache instance if
/// needed.
Expand Down
10 changes: 5 additions & 5 deletions packages/flame/pubspec.yaml
Expand Up @@ -8,20 +8,20 @@ funding:
- https://patreon.com/bluefireoss

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
collection: ^1.15.0
collection: ^1.17.1
flutter:
sdk: flutter
meta: ^1.7.0
meta: ^1.9.1
ordered_set: ^5.0.1
vector_math: ^2.1.1
vector_math: ^2.1.4

dev_dependencies:
canvas_test: ^0.2.0
dartdoc: ^6.0.1
dartdoc: ^6.2.2
flame_lint: ^0.2.0+2
flame_test: ^1.10.1
flutter_test:
Expand Down
Binary file modified packages/flame/test/_goldens/fixed_size_viewport_test_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/flame/test/_goldens/has_decorator_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/flame/test/_goldens/paint_decorator_blur.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/flame/test/_goldens/paint_decorator_grayscale.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/flame/test/_goldens/paint_decorator_with_blur.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/flame/test/_goldens/sprite_test_1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions packages/flame/test/collisions/collision_test_helpers.dart
Expand Up @@ -15,15 +15,15 @@ class CollisionDetectionWorld extends World with HasCollisionDetection {}
@isTest
Future<void> testCollisionDetectionGame(
String testName,
Future Function(HasCollidablesGame) testBody,
Future<void> Function(HasCollidablesGame) testBody,
) {
return testWithGame(testName, HasCollidablesGame.new, testBody);
}

@isTest
Future<void> testQuadTreeCollisionDetectionGame(
String testName,
Future Function(HasCollisionDetection) testBody,
Future<void> Function(HasCollisionDetection) testBody,
) {
return testWithGame(
testName,
Expand All @@ -39,7 +39,7 @@ Future<void> testQuadTreeCollisionDetectionGame(
}

Future<void> runCollisionTestRegistry(
Map<String, Future Function(HasCollisionDetection)> testRegistry,
Map<String, Future<void> Function(HasCollisionDetection)> testRegistry,
) async {
for (final entry in testRegistry.entries) {
final name = entry.key;
Expand Down
3 changes: 2 additions & 1 deletion packages/flame_audio/example/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
flame: ^1.7.3
Expand All @@ -16,6 +16,7 @@ dependencies:

dev_dependencies:
flame_lint: ^0.2.0+2

flutter:
assets:
- assets/audio/music/bg_music.ogg
Expand Down
8 changes: 4 additions & 4 deletions packages/flame_audio/pubspec.yaml
Expand Up @@ -9,16 +9,16 @@ funding:
- https://patreon.com/bluefireoss

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
audioplayers: ^4.0.0
audioplayers: ^4.0.1
flame: ^1.7.3
flutter:
sdk: flutter
synchronized: ^3.0.1
synchronized: ^3.1.0

dev_dependencies:
dartdoc: ^6.0.1
dartdoc: ^6.2.2
flame_lint: ^0.2.0+2
6 changes: 3 additions & 3 deletions packages/flame_bloc/example/lib/src/game.dart
Expand Up @@ -29,12 +29,12 @@ class GameView extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Column(
return const Column(
children: [
const GameStat(),
GameStat(),
Expanded(
child: Stack(
children: const [
children: [
Positioned.fill(child: Game()),
Positioned(top: 50, right: 10, child: Inventory()),
],
Expand Down
6 changes: 3 additions & 3 deletions packages/flame_bloc/example/pubspec.yaml
Expand Up @@ -6,15 +6,15 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
equatable: ^2.0.3
equatable: ^2.0.5
flame: ^1.7.3
flame_bloc: ^1.8.4
flutter:
sdk: flutter
flutter_bloc: ^8.0.1
flutter_bloc: ^8.1.2

dev_dependencies:
flame_lint: ^0.2.0+2
Expand Down
14 changes: 7 additions & 7 deletions packages/flame_bloc/pubspec.yaml
Expand Up @@ -8,22 +8,22 @@ funding:
- https://patreon.com/bluefireoss

environment:
sdk: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"
sdk: ">=2.18.0 <4.0.0"
flutter: ">=3.10.0"

dependencies:
bloc: ^8.0.2
bloc: ^8.1.1
flame: ^1.7.3
flutter:
sdk: flutter
flutter_bloc: ^8.0.1
meta: ^1.7.0
flutter_bloc: ^8.1.2
meta: ^1.9.1

dev_dependencies:
dartdoc: ^6.0.1
dartdoc: ^6.2.2
flame_lint: ^0.2.0+2
flame_test: ^1.10.1
flutter_lints: ^1.0.0
flutter_lints: ^2.0.1
flutter_test:
sdk: flutter
mocktail: ^0.3.0
2 changes: 1 addition & 1 deletion packages/flame_fire_atlas/example/pubspec.yaml
Expand Up @@ -6,7 +6,7 @@ publish_to: 'none'
version: 1.0.0+1

environment:
sdk: ">=2.18.0 <3.0.0"
sdk: ">=2.18.0 <4.0.0"

dependencies:
flame: ^1.7.3
Expand Down

0 comments on commit b41622d

Please sign in to comment.