chore: Fix Flutter 3.29.0 analyzer issues (#3492)

Fixes the analyze issues that the new flutter version triggered on.
This commit is contained in:
Lukas Klingsbo
2025-02-13 11:40:14 +01:00
committed by GitHub
parent bac68dcbb9
commit 9f54a698d2
13 changed files with 22 additions and 20 deletions

View File

@ -1,5 +1,3 @@
import 'dart:html';
import 'package:doc_flame_examples/anchor.dart';
import 'package:doc_flame_examples/anchor_by_effect.dart';
import 'package:doc_flame_examples/anchor_to_effect.dart';
@ -36,6 +34,7 @@ import 'package:doc_flame_examples/time_scale.dart';
import 'package:doc_flame_examples/value_route.dart';
import 'package:flame/game.dart';
import 'package:flutter/widgets.dart';
import 'package:web/web.dart' as web;
final routes = <String, Game Function()>{
'anchor_by_effect': AnchorByEffectGame.new,
@ -75,7 +74,7 @@ final routes = <String, Game Function()>{
};
void main() {
var page = window.location.search ?? '';
var page = web.window.location.search;
if (page.startsWith('?')) {
page = page.substring(1);
}
@ -104,7 +103,7 @@ class _IndexRoute extends StatelessWidget {
const Text('Select an option below:'),
...routes.keys.map((route) {
return GestureDetector(
onTap: () => window.location.replace('/?$route'),
onTap: () => web.window.location.replace('/?$route'),
child: Text(route),
);
}),

View File

@ -13,6 +13,7 @@ dependencies:
flame_rive: ^1.10.8
flutter:
sdk: flutter
web: ^1.1.0
dev_dependencies:
flame_lint: ^1.2.1

View File

@ -1,12 +1,13 @@
import 'dart:html'; // ignore: avoid_web_libraries_in_flutter
import 'package:flutter/widgets.dart';
import 'package:web/web.dart' as web;
import 'step2/main.dart' as step2;
import 'step3/main.dart' as step3;
import 'step4/main.dart' as step4;
import 'step5/main.dart' as step5;
void main() {
var page = window.location.search ?? '';
var page = web.window.location.search;
if (page.startsWith('?')) {
page = page.substring(1);
}

View File

@ -11,9 +11,11 @@ dependencies:
flame: ^1.24.0
flutter:
sdk: flutter
web: ^1.1.0
dev_dependencies:
flame_lint: ^1.2.1
flutter:
assets:
- assets/images/

View File

@ -1,5 +1,3 @@
import 'dart:html'; // ignore: avoid_web_libraries_in_flutter
import 'package:flutter/widgets.dart';
import 'package:tutorials_space_shooter/step1/main.dart' as step1;
import 'package:tutorials_space_shooter/step2/main.dart' as step2;
@ -7,9 +5,10 @@ import 'package:tutorials_space_shooter/step3/main.dart' as step3;
import 'package:tutorials_space_shooter/step4/main.dart' as step4;
import 'package:tutorials_space_shooter/step5/main.dart' as step5;
import 'package:tutorials_space_shooter/step6/main.dart' as step6;
import 'package:web/web.dart' as web;
void main() {
var page = window.location.search ?? '';
var page = web.window.location.search;
if (page.startsWith('?')) {
page = page.substring(1);
}
@ -25,7 +24,7 @@ void main() {
Directionality(
textDirection: TextDirection.ltr,
child: Text('''Error: unknown page. Pass "step{1,6}" as a GET param;
e.g: ${window.location}?step1'''),
e.g: ${web.window.location}?step1'''),
),
),
};

View File

@ -13,6 +13,7 @@ dependencies:
flame: ^1.24.0
flutter:
sdk: flutter
web: ^1.1.0
dev_dependencies:
flame_lint: ^1.2.1

View File

@ -13,7 +13,7 @@ dependencies:
flame_forge2d: ^0.18.2+5
flutter:
sdk: flutter
google_fonts: ^4.0.4
google_fonts: ^6.2.1
url_launcher: ^6.1.11
dev_dependencies:

View File

@ -1,4 +1,4 @@
// ignore_for_file: unused_element
// ignore_for_file: unused_element, unused_element_parameter
import 'dart:ui';

View File

@ -1,10 +1,10 @@
import 'dart:html';
import 'package:examples/platform/page_provider.dart';
import 'package:web/web.dart';
class PageProviderImpl extends PageProvider {
@override
String? getPage() {
var page = window.location.search ?? '';
var page = window.location.search;
if (page.startsWith('?')) {
page = page.substring(1);
}

View File

@ -23,13 +23,14 @@ dependencies:
flame_tiled: ^2.0.0
flutter:
sdk: flutter
google_fonts: ^4.0.4
google_fonts: ^6.2.1
jenny: ^1.3.2
meta: ^1.12.0
padracing: ^1.0.0
provider: ^6.0.5
provider: ^6.1.2
rogue_shooter: ^0.1.0
trex_game: ^0.1.0
web: ^1.1.0
dev_dependencies:
flame_lint: ^1.2.1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -6,7 +6,7 @@ import 'package:flutter_test/flutter_test.dart';
class _Wrapper extends StatefulWidget {
const _Wrapper({
required this.child,
// ignore: unused_element
// ignore: unused_element, unused_element_parameter
this.small = false,
});

View File

@ -87,7 +87,6 @@ linter:
- noop_primitive_operations
- null_closures
- omit_local_variable_types
- package_api_docs
- package_names
- package_prefixed_library_names
- parameter_assignments
@ -155,7 +154,6 @@ linter:
- unnecessary_this
- unnecessary_to_list_in_spreads
- unrelated_type_equality_checks
- unsafe_html
- use_enums
- use_full_hex_values_for_flutter_colors
- use_function_type_syntax_for_parameters