diff --git a/examples/lib/stories/camera_and_viewport/follow_component_example.dart b/examples/lib/stories/camera_and_viewport/follow_component_example.dart index 949638b69..eedbc14d8 100644 --- a/examples/lib/stories/camera_and_viewport/follow_component_example.dart +++ b/examples/lib/stories/camera_and_viewport/follow_component_example.dart @@ -132,7 +132,7 @@ class MovableEmber extends Ember class Map extends Component { static const double size = 1500; static const Rect _bounds = Rect.fromLTRB(-size, -size, size, size); - static Rectangle bounds = Rectangle.fromLTRB(-size, -size, size, size); + static final Rectangle bounds = Rectangle.fromLTRB(-size, -size, size, size); static final Paint _paintBorder = Paint() ..color = Colors.white12 diff --git a/examples/lib/stories/components/clip_component_example.dart b/examples/lib/stories/components/clip_component_example.dart index 75ae70a57..28e0de87e 100644 --- a/examples/lib/stories/components/clip_component_example.dart +++ b/examples/lib/stories/components/clip_component_example.dart @@ -28,7 +28,8 @@ class _Rectangle extends RectangleComponent { } class ClipComponentExample extends FlameGame with TapDetector { - static String description = 'Tap on the objects to increase their size.'; + static const String description = + 'Tap on the objects to increase their size.'; @override Future onLoad() async { diff --git a/examples/lib/stories/components/components_notifier_provider_example.dart b/examples/lib/stories/components/components_notifier_provider_example.dart index 81826b5fc..b21bd6180 100644 --- a/examples/lib/stories/components/components_notifier_provider_example.dart +++ b/examples/lib/stories/components/components_notifier_provider_example.dart @@ -7,7 +7,7 @@ import 'package:provider/provider.dart'; class ComponentsNotifierProviderExampleWidget extends StatefulWidget { const ComponentsNotifierProviderExampleWidget({super.key}); - static String description = ''' + static const String description = ''' Similar to the Components Notifier example, but uses provider instead of the built in ComponentsNotifierBuilder widget. '''; diff --git a/examples/lib/stories/components/spawn_component_example.dart b/examples/lib/stories/components/spawn_component_example.dart index 315496b04..da4211d54 100644 --- a/examples/lib/stories/components/spawn_component_example.dart +++ b/examples/lib/stories/components/spawn_component_example.dart @@ -7,7 +7,7 @@ import 'package:flame/input.dart'; import 'package:flame/math.dart'; class SpawnComponentExample extends FlameGame with TapDetector { - static String description = + static const String description = 'Tap on the screen to start spawning Embers within different shapes.'; @override diff --git a/examples/lib/stories/rendering/rich_text_example.dart b/examples/lib/stories/rendering/rich_text_example.dart index e5b25eacd..d7560f3fb 100644 --- a/examples/lib/stories/rendering/rich_text_example.dart +++ b/examples/lib/stories/rendering/rich_text_example.dart @@ -4,8 +4,8 @@ import 'package:flame/text.dart'; import 'package:flutter/painting.dart'; class RichTextExample extends FlameGame { - static String description = 'A non-interactive example of how to render rich ' - 'text in Flame.'; + static const String description = + 'A non-interactive example of how to render rich text in Flame.'; @override Color backgroundColor() => const Color(0xFF888888); diff --git a/packages/flame/example/lib/main.dart b/packages/flame/example/lib/main.dart index 4ee6b7b8e..efbd0af5a 100644 --- a/packages/flame/example/lib/main.dart +++ b/packages/flame/example/lib/main.dart @@ -38,8 +38,8 @@ class Square extends RectangleComponent with TapCallbacks { static const squareSize = 128.0; static const indicatorSize = 6.0; - static Paint red = BasicPalette.red.paint(); - static Paint blue = BasicPalette.blue.paint(); + static final Paint red = BasicPalette.red.paint(); + static final Paint blue = BasicPalette.blue.paint(); Square(Vector2 position) : super( diff --git a/packages/flame_audio/example/lib/main.dart b/packages/flame_audio/example/lib/main.dart index 16fe53b6d..616d9c9aa 100644 --- a/packages/flame_audio/example/lib/main.dart +++ b/packages/flame_audio/example/lib/main.dart @@ -18,9 +18,9 @@ void main() { /// for tapping elsewhere. /// 3. Uses the Bgm utility for background music. class AudioGame extends FlameGame with TapDetector { - static Paint black = BasicPalette.black.paint(); - static Paint gray = const PaletteEntry(Color(0xFFCCCCCC)).paint(); - static TextPaint text = TextPaint( + static final Paint black = BasicPalette.black.paint(); + static final Paint gray = const PaletteEntry(Color(0xFFCCCCCC)).paint(); + static final TextPaint text = TextPaint( style: TextStyle(color: BasicPalette.white.color), ); diff --git a/packages/flame_isolate/example/lib/game_map/game_map.dart b/packages/flame_isolate/example/lib/game_map/game_map.dart index ff5bad555..94a1244b6 100755 --- a/packages/flame_isolate/example/lib/game_map/game_map.dart +++ b/packages/flame_isolate/example/lib/game_map/game_map.dart @@ -18,9 +18,9 @@ class GameMap extends Component with HasGameReference { static const mapSizeY = 50; static const totalPositions = mapSizeX * mapSizeY; - static int cheeseSpread = (0.03 * totalPositions).toInt(); - static int breadSpread = (0.05 * totalPositions).toInt(); - static int workerSpread = (0.1 * totalPositions).toInt(); + static final int cheeseSpread = (0.03 * totalPositions).toInt(); + static final int breadSpread = (0.05 * totalPositions).toInt(); + static final int workerSpread = (0.1 * totalPositions).toInt(); static const double workerMinSpeed = 25; static const double workerMaxSpeed = 75;