feat: Add more lint rules (#1703)

Adds some more lint rules and fixes the issues those rules pointed out.
This commit is contained in:
Lukas Klingsbo
2022-06-06 21:23:25 +02:00
committed by GitHub
parent a15eda0b67
commit 49252f8ef2
50 changed files with 141 additions and 140 deletions

View File

@ -8,10 +8,9 @@ environment:
flutter: ^2.10.0 flutter: ^2.10.0
dependencies: dependencies:
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
flame:
path: ../../../packages/flame
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1 flame_lint: ^0.0.1

View File

@ -5,7 +5,10 @@ import 'package:klondike/step3/klondike_game.dart';
@immutable @immutable
class Rank { class Rank {
factory Rank.fromInt(int value) { factory Rank.fromInt(int value) {
assert(value >= 1 && value <= 13); assert(
value >= 1 && value <= 13,
'value is outside of the bounds of what a rank can be',
);
return _singletons[value - 1]; return _singletons[value - 1];
} }

View File

@ -5,7 +5,10 @@ import 'package:klondike/step3/klondike_game.dart';
@immutable @immutable
class Suit { class Suit {
factory Suit.fromInt(int index) { factory Suit.fromInt(int index) {
assert(index >= 0 && index <= 3); assert(
index >= 0 && index <= 3,
'index is outside of the bounds of what a suit can be',
);
return _singletons[index]; return _singletons[index];
} }

View File

@ -7,10 +7,9 @@ environment:
sdk: ^2.15.0 sdk: ^2.15.0
dependencies: dependencies:
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
flame:
path: ../../../../packages/flame
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1 flame_lint: ^0.0.1

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart' hide Image, Gradient; import 'package:flutter/material.dart' hide Image, Gradient;
import 'package:padracing/menu_card.dart'; import 'package:padracing/menu_card.dart';
import 'package:padracing/padracing_game.dart'; import 'package:padracing/padracing_game.dart';
@ -29,8 +28,8 @@ class GameOver extends StatelessWidget {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ElevatedButton( ElevatedButton(
child: const Text('Restart'),
onPressed: game.reset, onPressed: game.reset,
child: const Text('Restart'),
), ),
], ],
), ),

View File

@ -164,9 +164,8 @@ class Tire extends BodyComponent<PadRacingGame> {
if (isTurnableTire && isTurning) { if (isTurnableTire && isTurning) {
final turnPerTimeStep = _turnSpeedPerSecond * dt; final turnPerTimeStep = _turnSpeedPerSecond * dt;
final angleNow = joint.jointAngle(); final angleNow = joint.jointAngle();
final angleToTurn = (desiredAngle - angleNow) final angleToTurn =
.clamp(-turnPerTimeStep, turnPerTimeStep) (desiredAngle - angleNow).clamp(-turnPerTimeStep, turnPerTimeStep);
.toDouble();
final angle = angleNow + angleToTurn; final angle = angleNow + angleToTurn;
joint.setLimits(angle, angle); joint.setLimits(angle, angle);
} else { } else {

View File

@ -7,17 +7,17 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flutter:
sdk: flutter
flame: ^1.1.1 flame: ^1.1.1
flame_forge2d: ^0.11.0 flame_forge2d: ^0.11.0
flutter:
sdk: flutter
google_fonts: ^2.3.2 google_fonts: ^2.3.2
url_launcher: ^6.1.2 url_launcher: ^6.1.2
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint: ^0.0.1
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -11,7 +11,6 @@ environment:
dependencies: dependencies:
flame: ^1.1.1 flame: ^1.1.1
google_fonts: ^2.3.2
flutter: flutter:
sdk: flutter sdk: flutter

View File

@ -421,7 +421,10 @@ class Ant extends PositionComponent {
travelDirection = -travelDirection; travelDirection = -travelDirection;
} }
final nextIndex = travelPathNodeIndex + travelDirection; final nextIndex = travelPathNodeIndex + travelDirection;
assert(nextIndex >= 0 && nextIndex < travelPath.length); assert(
nextIndex >= 0 && nextIndex < travelPath.length,
'nextIndex is outside of the bounds of travelPath',
);
final nextPosition = travelPath[nextIndex]; final nextPosition = travelPath[nextIndex];
var nextAngle = var nextAngle =
angle = -(nextPosition - position).angleToSigned(Vector2(0, -1)); angle = -(nextPosition - position).angleToSigned(Vector2(0, -1));
@ -480,7 +483,7 @@ class InsectLeg {
path = Path(), path = Path(),
foot = Vector2.zero() { foot = Vector2.zero() {
final ok = placeFoot(Vector2(x1, y1)); final ok = placeFoot(Vector2(x1, y1));
assert(ok); assert(ok, 'The foot was not properly placed');
} }
/// Place where the leg is attached to the body /// Place where the leg is attached to the body

View File

@ -213,26 +213,26 @@ class _CoordinateSystemsState extends State<CoordinateSystemsWidget> {
required bool start, required bool start,
}) { }) {
final add = Container( final add = Container(
margin: const EdgeInsets.all(32),
child: Center( child: Center(
child: TextButton( child: TextButton(
child: const Text('+'), child: const Text('+'),
onPressed: () => setState(() => blocks[index]++), onPressed: () => setState(() => blocks[index]++),
), ),
), ),
margin: const EdgeInsets.all(32),
); );
return [ return [
if (start) add, if (start) add,
for (int i = 1; i <= blocks[index]; i++) for (int i = 1; i <= blocks[index]; i++)
GestureDetector( GestureDetector(
child: Container( child: Container(
margin: const EdgeInsets.all(32),
child: Center( child: Center(
child: RotatedBox( child: RotatedBox(
quarterTurns: rotated ? 1 : 0, quarterTurns: rotated ? 1 : 0,
child: Text('Block $i'), child: Text('Block $i'),
), ),
), ),
margin: const EdgeInsets.all(32),
), ),
onTap: () => setState(() => blocks[index]--), onTap: () => setState(() => blocks[index]--),
), ),

View File

@ -119,7 +119,7 @@ class Compass extends PositionComponent {
class CompassArrow extends PositionComponent { class CompassArrow extends PositionComponent {
CompassArrow({required double width, required double radius}) CompassArrow({required double width, required double radius})
: assert(width <= radius), : assert(width <= radius, 'The width is larger than the radius'),
_radius = radius, _radius = radius,
_width = width, _width = width,
super(size: Vector2(width, 2 * radius), anchor: Anchor.center); super(size: Vector2(width, 2 * radius), anchor: Anchor.center);
@ -154,7 +154,7 @@ class CompassArrow extends PositionComponent {
class CompassRim extends PositionComponent { class CompassRim extends PositionComponent {
CompassRim({required double radius, required double width}) CompassRim({required double radius, required double width})
: assert(radius > width), : assert(radius > width, 'The width is larger than the radius'),
_radius = radius, _radius = radius,
_width = width, _width = width,
super( super(

View File

@ -47,7 +47,10 @@ class ShapesExample extends FlameGame {
class ShapesComponent extends Component { class ShapesComponent extends Component {
ShapesComponent(this.shapes, List<Color> colors) ShapesComponent(this.shapes, List<Color> colors)
: assert(shapes.length == colors.length), : assert(
shapes.length == colors.length,
'The shapes and colors lists have to be of the same length',
),
paints = colors paints = colors
.map( .map(
(color) => Paint() (color) => Paint()
@ -70,7 +73,10 @@ class ShapesComponent extends Component {
class DotsComponent extends Component { class DotsComponent extends Component {
DotsComponent(this.shapes, this.shapeColors) DotsComponent(this.shapes, this.shapeColors)
: assert(shapes.length == shapeColors.length); : assert(
shapes.length == shapeColors.length,
'The shapes and shapeColors lists have to be of the same length',
);
final List<Shape> shapes; final List<Shape> shapes;
final List<Color> shapeColors; final List<Color> shapeColors;

View File

@ -14,7 +14,7 @@ Widget spriteButtonBuilder(DashbookContext ctx) {
pressedSrcPosition: Vector2(0, 20), pressedSrcPosition: Vector2(0, 20),
pressedSrcSize: Vector2(60, 20), pressedSrcSize: Vector2(60, 20),
onPressed: () { onPressed: () {
print('Pressed'); // Do something
}, },
label: const Text( label: const Text(
'Sprite Button', 'Sprite Button',

View File

@ -10,17 +10,17 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
flame: ^1.1.1
flame_svg: ^1.2.0
flame_forge2d: ^0.11.0
dashbook: 0.1.6 dashbook: 0.1.6
google_fonts: ^2.3.2 flame: ^1.1.1
flame_forge2d: ^0.11.0
flame_svg: ^1.2.0
flutter: flutter:
sdk: flutter sdk: flutter
trex_game: google_fonts: ^2.3.2
path: games/trex
padracing: padracing:
path: games/padracing path: games/padracing
trex_game:
path: games/trex
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1 flame_lint: ^0.0.1

View File

@ -8,13 +8,11 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
flame: flame: ^1.1.1
path: ../
flutter: flutter:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint:
path: ../../flame_lint

View File

@ -97,7 +97,7 @@ class Anchor {
/// ///
/// If you need to convert anchors to serializable data (like JSON), /// If you need to convert anchors to serializable data (like JSON),
/// use the `toString()` and `valueOf` methods. /// use the `toString()` and `valueOf` methods.
static Anchor valueOf(String name) { factory Anchor.valueOf(String name) {
if (_valueNames.containsValue(name)) { if (_valueNames.containsValue(name)) {
return _valueNames.entries.singleWhere((e) => e.value == name).key; return _valueNames.entries.singleWhere((e) => e.value == name).key;
} else { } else {

View File

@ -23,7 +23,7 @@ class ComponentSet extends QueryableOrderedSet<Component> {
); );
@Deprecated('Use ComponentSet.new instead; will be removed in 1.3.0') @Deprecated('Use ComponentSet.new instead; will be removed in 1.3.0')
static ComponentSet createDefault() => ComponentSet(); ComponentSet.createDefault() : this();
/// Components whose priority changed since the last update. /// Components whose priority changed since the last update.
/// ///

View File

@ -11,6 +11,7 @@ import 'package:flame/src/particles/particle.dart';
class ParticleComponent extends Component { class ParticleComponent extends Component {
Particle particle; Particle particle;
@Deprecated('Will be removed after v1.1, use ParticleSystemComponent instead')
ParticleComponent(this.particle); ParticleComponent(this.particle);
/// Returns progress of the child [Particle]. /// Returns progress of the child [Particle].

View File

@ -120,7 +120,7 @@ class FlameGame extends Component with Game {
var repeat = true; var repeat = true;
while (repeat) { while (repeat) {
// Give chance to other futures to execute first // Give chance to other futures to execute first
await Future<void>.delayed(const Duration()); await Future<void>.delayed(Duration.zero);
repeat = false; repeat = false;
descendants(includeSelf: true).forEach( descendants(includeSelf: true).forEach(
(Component child) { (Component child) {

View File

@ -11,12 +11,12 @@ class Line {
const Line(this.a, this.b, this.c); const Line(this.a, this.b, this.c);
static Line fromPoints(Vector2 p1, Vector2 p2) { Line.fromPoints(Vector2 p1, Vector2 p2)
final a = p2.y - p1.y; : this(
final b = p1.x - p2.x; p2.y - p1.y,
final c = p2.y * p1.x - p1.y * p2.x; p1.x - p2.x,
return Line(a, b, c); p2.y * p1.x - p1.y * p2.x,
} );
/// Returns an empty list if there is no intersection /// Returns an empty list if there is no intersection
/// If the lines are concurrent it returns one point in the list. /// If the lines are concurrent it returns one point in the list.

View File

@ -84,7 +84,7 @@ class ImageComposition {
/// Compose all the images into a single composition. /// Compose all the images into a single composition.
Future<Image> compose() async { Future<Image> compose() async {
// Rect used to determine how big the output image will be. // Rect used to determine how big the output image will be.
var output = const Rect.fromLTWH(0, 0, 0, 0); var output = Rect.zero;
final recorder = PictureRecorder(); final recorder = PictureRecorder();
final canvas = Canvas(recorder); final canvas = Canvas(recorder);

View File

@ -107,8 +107,8 @@ class NineTileBoxWidget extends StatelessWidget {
destTileSize: destTileSize, destTileSize: destTileSize,
width: width, width: width,
height: height, height: height,
child: child,
padding: padding, padding: padding,
child: child,
); );
}, },
errorBuilder: errorBuilder, errorBuilder: errorBuilder,
@ -152,8 +152,8 @@ class InternalNineTileBox extends StatelessWidget {
destTileSize: destTileSize, destTileSize: destTileSize,
), ),
child: Container( child: Container(
child: child,
padding: padding, padding: padding,
child: child,
), ),
), ),
); );

View File

@ -8,19 +8,19 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
collection: ^1.15.0
flutter: flutter:
sdk: flutter sdk: flutter
meta: ^1.7.0 meta: ^1.7.0
collection: ^1.15.0
ordered_set: ^5.0.0 ordered_set: ^5.0.0
vector_math: ^2.1.1 vector_math: ^2.1.1
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0
mocktail: ^0.3.0
canvas_test: ^0.2.0 canvas_test: ^0.2.0
flame_test: ^1.4.0 dartdoc: ^4.1.0
flame_lint: ^0.0.1 flame_lint: ^0.0.1
test: any flame_test: ^1.4.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
mocktail: ^0.3.0
test: any

View File

@ -61,6 +61,7 @@ void main() {
} }
final totalTime = DateTime.now().millisecondsSinceEpoch - final totalTime = DateTime.now().millisecondsSinceEpoch -
startTime.millisecondsSinceEpoch; startTime.millisecondsSinceEpoch;
// ignore:avoid_print
print( print(
'$totalTime ms\n' '$totalTime ms\n'
'${1000 / (totalTime / ticks)} runs per second\n' '${1000 / (totalTime / ticks)} runs per second\n'

View File

@ -69,7 +69,7 @@ FlameTester<_MyGame> myGame({required bool open}) {
return FlameTester( return FlameTester(
_MyGame.new, _MyGame.new,
pumpWidget: (gameWidget, tester) async { pumpWidget: (gameWidget, tester) async {
await tester.pumpWidget(_Wrapper(child: gameWidget, open: open)); await tester.pumpWidget(_Wrapper(open: open, child: gameWidget));
}, },
); );
} }

View File

@ -94,7 +94,7 @@ Future<SpriteFontRenderer> createRenderer({
const lines = [ const lines = [
'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz', 'abcdefghijklmnopqrstuvwxyz',
'0123456789.,:;—_!?@\$%+-=/*', r'0123456789.,:;—_!?@$%+-=/*',
'#^&()[]{}<>|\\\'"`~←→↑↓ ', '#^&()[]{}<>|\\\'"`~←→↑↓ ',
]; ];
return SpriteFontRenderer( return SpriteFontRenderer(

View File

@ -9,16 +9,13 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flame: flame: ^1.1.1
path: ../../flame flame_audio: ^1.0.2
flame_audio:
path: ../
flutter: flutter:
sdk: flutter sdk: flutter
dev_dependencies: dev_dependencies:
flame_lint: flame_lint: ^0.0.1
path: ../../flame_lint
flutter: flutter:
assets: assets:

View File

@ -8,11 +8,11 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
flame: ^1.1.1
audioplayers: ^0.20.1 audioplayers: ^0.20.1
synchronized: ^3.0.0 flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
synchronized: ^3.0.0
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0

View File

@ -9,20 +9,16 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
equatable: ^2.0.3
flame_bloc: ^1.4.0
flutter: flutter:
sdk: flutter sdk: flutter
cupertino_icons: ^1.0.2
equatable: ^2.0.3
flame_bloc:
path: ../
flutter_bloc: ^8.0.1 flutter_bloc: ^8.0.1
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^1.0.0
flame_lint:
path: ../../flame_lint
flutter: flutter:

View File

@ -138,5 +138,6 @@ mixin FlameBloc on FlameGame {
class FlameBlocGame extends FlameGame with FlameBloc { class FlameBlocGame extends FlameGame with FlameBloc {
/// FlameBlocGame constructor with an optional [Camera] as a parameter to /// FlameBlocGame constructor with an optional [Camera] as a parameter to
/// FlameGame. /// FlameGame.
@Deprecated('Use FlameBlocProvider and FlameBlocListener instead')
FlameBlocGame({Camera? camera}) : super(camera: camera); FlameBlocGame({Camera? camera}) : super(camera: camera);
} }

View File

@ -8,18 +8,18 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
bloc: ^8.0.2
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
bloc: ^8.0.2
meta: ^1.7.0
flame: ^1.1.1
flutter_bloc: ^8.0.1 flutter_bloc: ^8.0.1
meta: ^1.7.0
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0
flame_lint: ^0.0.1
flame_test: ^1.4.0
flutter_lints: ^1.0.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^1.0.0
flame_test: ^1.4.0
mocktail: ^0.3.0 mocktail: ^0.3.0
flame_lint: ^0.0.1

View File

@ -9,19 +9,15 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flame: ^1.1.1
flame_fire_atlas: ^1.0.2
flutter: flutter:
sdk: flutter sdk: flutter
cupertino_icons: ^0.1.3
flame:
path: ../../flame
flame_fire_atlas:
path: ../
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint:
path: ../../flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -238,13 +238,13 @@ class FireAtlas {
..['id'] = id ..['id'] = id
..['imageData'] = imageData ..['imageData'] = imageData
..['selections'] = selectionsJson ..['selections'] = selectionsJson
..['tileWidth'] = tileWidth.toDouble() ..['tileWidth'] = tileWidth
..['tileHeight'] = tileHeight.toDouble(); ..['tileHeight'] = tileHeight;
return json; return json;
} }
static FireAtlas _fromJson(Map<String, dynamic> json) { factory FireAtlas._fromJson(Map<String, dynamic> json) {
final tileHeight = json['tileHeight'] as num?; final tileHeight = json['tileHeight'] as num?;
final tileWidth = json['tileWidth'] as num?; final tileWidth = json['tileWidth'] as num?;
final tileSize = json['tileSize'] as num? ?? 0; final tileSize = json['tileSize'] as num? ?? 0;
@ -297,15 +297,17 @@ class FireAtlas {
} }
/// Reads a [FireAtlas] instance from a byte array. /// Reads a [FireAtlas] instance from a byte array.
static FireAtlas deserialize(List<int> bytes) { factory FireAtlas.deserialize(List<int> bytes) {
final unzippedBytes = GZipDecoder().decodeBytes(bytes); final unzippedBytes = GZipDecoder().decodeBytes(bytes);
final unzippedString = utf8.decode(unzippedBytes); final unzippedString = utf8.decode(unzippedBytes);
return _fromJson(jsonDecode(unzippedString) as Map<String, dynamic>); return FireAtlas._fromJson(
jsonDecode(unzippedString) as Map<String, dynamic>,
);
} }
Image _assertImageLoaded() { Image _assertImageLoaded() {
if (_image == null) { if (_image == null) {
throw 'Atlas is not loaded yet, call "load" before using it'; throw Exception('Atlas is not loaded yet, call "load" before using it');
} }
return _image!; return _image!;

View File

@ -8,14 +8,14 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
archive: ^3.1.5
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
flame: ^1.1.1
archive: ^3.1.5
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint: ^0.0.1
mocktail: ^0.3.0 mocktail: ^0.3.0
dartdoc: ^4.1.0

View File

@ -10,18 +10,15 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
dashbook: ^0.1.6
flame_forge2d: ^0.11.0
flutter: flutter:
sdk: flutter sdk: flutter
flame_forge2d:
path: ../
dashbook: ^0.1.6
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint:
path: ../../flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -16,8 +16,8 @@ dependencies:
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0
flame_lint: ^0.0.1 flame_lint: ^0.0.1
flame_test: ^1.4.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_test: ^1.4.0
mocktail: ^0.3.0 mocktail: ^0.3.0
test: any test: any

View File

@ -26,6 +26,7 @@ linter:
- avoid_init_to_null - avoid_init_to_null
- avoid_js_rounded_ints - avoid_js_rounded_ints
- avoid_null_checks_in_equality_operators - avoid_null_checks_in_equality_operators
- avoid_print
- avoid_private_typedef_functions - avoid_private_typedef_functions
- avoid_redundant_argument_values - avoid_redundant_argument_values
- avoid_relative_lib_imports - avoid_relative_lib_imports
@ -36,6 +37,7 @@ linter:
- avoid_type_to_string - avoid_type_to_string
- avoid_types_as_parameter_names - avoid_types_as_parameter_names
- avoid_unused_constructor_parameters - avoid_unused_constructor_parameters
- avoid_void_async
- await_only_futures - await_only_futures
- camel_case_extensions - camel_case_extensions
- camel_case_types - camel_case_types
@ -46,6 +48,7 @@ linter:
- constant_identifier_names - constant_identifier_names
- control_flow_in_finally - control_flow_in_finally
- curly_braces_in_flow_control_structures - curly_braces_in_flow_control_structures
- deprecated_consistency
- directives_ordering - directives_ordering
- do_not_use_environment - do_not_use_environment
- empty_catches - empty_catches
@ -69,6 +72,8 @@ linter:
- no_duplicate_case_values - no_duplicate_case_values
- no_runtimeType_toString - no_runtimeType_toString
- non_constant_identifier_names - non_constant_identifier_names
- noop_primitive_operations
- null_closures
- omit_local_variable_types - omit_local_variable_types
- package_api_docs - package_api_docs
- package_names - package_names
@ -82,6 +87,7 @@ linter:
- prefer_const_constructors_in_immutables - prefer_const_constructors_in_immutables
- prefer_const_declarations - prefer_const_declarations
- prefer_const_literals_to_create_immutables - prefer_const_literals_to_create_immutables
- prefer_constructors_over_static_methods
- prefer_contains - prefer_contains
- prefer_equal_for_default_values - prefer_equal_for_default_values
- prefer_final_fields - prefer_final_fields
@ -109,6 +115,8 @@ linter:
- recursive_getters - recursive_getters
- require_trailing_commas - require_trailing_commas
- slash_for_doc_comments - slash_for_doc_comments
- sort_child_properties_last
- sort_pub_dependencies
- sort_unnamed_constructors_first - sort_unnamed_constructors_first
- test_types_in_equals - test_types_in_equals
- throw_in_finally - throw_in_finally
@ -117,6 +125,7 @@ linter:
- unnecessary_await_in_return - unnecessary_await_in_return
- unnecessary_brace_in_string_interps - unnecessary_brace_in_string_interps
- unnecessary_const - unnecessary_const
- unnecessary_constructor_name
- unnecessary_getters_setters - unnecessary_getters_setters
- unnecessary_lambdas - unnecessary_lambdas
- unnecessary_new - unnecessary_new
@ -133,11 +142,15 @@ linter:
- unnecessary_this - unnecessary_this
- unrelated_type_equality_checks - unrelated_type_equality_checks
- unsafe_html - unsafe_html
- use_enums
- use_full_hex_values_for_flutter_colors - use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters - use_function_type_syntax_for_parameters
- use_if_null_to_convert_nulls_to_bools - use_if_null_to_convert_nulls_to_bools
- use_is_even_rather_than_modulo - use_is_even_rather_than_modulo
- use_key_in_widget_constructors - use_key_in_widget_constructors
- use_late_for_private_fields_and_variables
- use_named_constants
- use_raw_strings
- use_rethrow_when_possible - use_rethrow_when_possible
- use_test_throws_matchers - use_test_throws_matchers
- valid_regexps - valid_regexps

View File

@ -9,16 +9,13 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flame: ^1.1.1
flame_oxygen: ^0.1.2
flutter: flutter:
sdk: flutter sdk: flutter
flame:
path: ../../flame
flame_oxygen:
path: ../
dev_dependencies: dev_dependencies:
flame_lint: flame_lint: ^0.0.1
path: ../../flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -8,9 +8,9 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
flame: ^1.1.1
oxygen: ^0.2.0 oxygen: ^0.2.0
dev_dependencies: dev_dependencies:

View File

@ -7,19 +7,16 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
rive: 0.8.4 flame: ^1.1.1
flame_rive: flame_rive: ^1.2.0
path: ../
flame:
path: ../../flame
flutter: flutter:
sdk: flutter sdk: flutter
rive: 0.8.4
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint:
path: ../../flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -9,12 +9,12 @@ environment:
dependencies: dependencies:
flame: ^1.1.1 flame: ^1.1.1
rive: ^0.8.4
flutter: flutter:
sdk: flutter sdk: flutter
rive: ^0.8.4
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint: ^0.0.1

View File

@ -9,17 +9,15 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flame: ^1.1.1
flame_svg: ^1.2.0
flutter: flutter:
sdk: flutter sdk: flutter
flame: ^1.1.1
flame_svg:
path: ../
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flame_lint:
path: ../../flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true

View File

@ -9,12 +9,12 @@ environment:
dependencies: dependencies:
flame: ^1.1.1 flame: ^1.1.1
flutter_svg: ^1.0.3
flutter: flutter:
sdk: flutter sdk: flutter
flutter_svg: ^1.0.3
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0
flame_lint: ^0.0.1 flame_lint: ^0.0.1
test: ^1.17.12
mocktail: ^0.3.0 mocktail: ^0.3.0
test: ^1.17.12

View File

@ -8,13 +8,13 @@ environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"
dependencies: dependencies:
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
flame: ^1.1.1
dev_dependencies: dev_dependencies:
flame_test:
path: ../
flame_lint: ^0.0.1 flame_lint: ^0.0.1
flame_test: ^1.4.0
flutter: flutter:
assets: assets:

View File

@ -42,7 +42,7 @@ void testRandom(
int? retry, int? retry,
int repeatCount = 1, int repeatCount = 1,
}) { }) {
assert(repeatCount > 0); assert(repeatCount > 0, 'repeatCount needs to be a positive number');
for (var i = 0; i < repeatCount; i++) { for (var i = 0; i < repeatCount; i++) {
final seed0 = seed ?? _seedGenerator.nextInt(_maxSeed); final seed0 = seed ?? _seedGenerator.nextInt(_maxSeed);
test( test(

View File

@ -6,6 +6,7 @@ void main() {
test('without message', () { test('without message', () {
expect( expect(
() { () {
// ignore: prefer_asserts_with_message
assert(2 + 2 == 5); assert(2 + 2 == 5);
}, },
failsAssert(), failsAssert(),

View File

@ -6,7 +6,7 @@ void main() {
var instructions = 0; var instructions = 0;
tearDown(() { tearDown(() {
assert(instructions == 9); assert(instructions == 9, 'There should be exactly 9 instructions');
}); });
flameGame.test( flameGame.test(
'runs all the async tests', 'runs all the async tests',

View File

@ -8,8 +8,7 @@ environment:
dependencies: dependencies:
flame: ^1.1.1 flame: ^1.1.1
flame_tiled: flame_tiled: ^1.4.0
path: ../
flutter: flutter:
sdk: flutter sdk: flutter

View File

@ -8,13 +8,13 @@ environment:
flutter: ">=2.10.0" flutter: ">=2.10.0"
dependencies: dependencies:
flame: ^1.1.1
tiled: ^0.8.1
xml: ^5.3.0
meta: ^1.7.0
collection: ^1.15.0 collection: ^1.15.0
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
meta: ^1.7.0
tiled: ^0.8.1
xml: ^5.3.0
dev_dependencies: dev_dependencies:
dartdoc: ^4.1.0 dartdoc: ^4.1.0

View File

@ -9,21 +9,18 @@ environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
dependencies: dependencies:
dashbook: ^0.1.5
flame: ^1.1.1
flutter: flutter:
sdk: flutter sdk: flutter
cupertino_icons: ^1.0.2
dashbook: ^0.1.5
flame:
path: ../../packages/flame
flutter_markdown: ^0.6.7
flutter_highlight: ^0.7.0 flutter_highlight: ^0.7.0
flutter_markdown: ^0.6.7
dev_dependencies: dev_dependencies:
flame_lint: ^0.0.1
flutter_lints: ^1.0.0
flutter_test: flutter_test:
sdk: flutter sdk: flutter
flutter_lints: ^1.0.0
flame_lint:
path: ../../packages/flame_lint
flutter: flutter:
uses-material-design: true uses-material-design: true