fix(flutter): five flutter analyze --fatal-infos issues from first CI run
1. lib/app.dart + lib/shared/routing.dart — buildRouter takes a Ref but was being called from a ConsumerWidget's build() with a WidgetRef. Add a routerProvider; the widget watches it instead of constructing the router from its own ref. Real bug — would have crashed compile in slice 1, just never compiled until CI ran. 2. lib/player/audio_handler.dart — override of AudioHandler.seek used `p` for the Duration; rename to `position` to match the base class (avoid_renaming_method_parameters lint). 3. lib/theme/theme_extension.dart — fromTokens() returned a non-const constructor; all inputs are const so make the call const too (prefer_const_constructors). 4. test/library/home_screen_test.dart — same const-constructor lint on the HomeData test fixture. 5. test/smoke_test.dart — drop the unused `import 'package:flutter/material.dart'`. These are exactly the kind of issues the no-in-task-tests rule shifted to CI; this is the first run that actually exercises the analyzer against the slice 1 code.
This commit is contained in:
@@ -9,7 +9,7 @@ class MinstrelApp extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final router = buildRouter(ref);
|
||||
final router = ref.watch(routerProvider);
|
||||
return MaterialApp.router(
|
||||
title: 'Minstrel',
|
||||
theme: buildThemeData(),
|
||||
|
||||
@@ -55,7 +55,7 @@ class MinstrelAudioHandler extends BaseAudioHandler with QueueHandler, SeekHandl
|
||||
Future<void> pause() => _player.pause();
|
||||
|
||||
@override
|
||||
Future<void> seek(Duration p) => _player.seek(p);
|
||||
Future<void> seek(Duration position) => _player.seek(position);
|
||||
|
||||
@override
|
||||
Future<void> skipToNext() => _player.seekToNext();
|
||||
|
||||
@@ -12,6 +12,12 @@ import '../player/now_playing_screen.dart';
|
||||
import '../player/player_bar.dart';
|
||||
import 'widgets/version_gate.dart';
|
||||
|
||||
/// Exposed as a Provider so its single argument is a real `Ref` (the
|
||||
/// constructor's redirect closures use `ref.read`). Widgets consume the
|
||||
/// router via `ref.watch(routerProvider)` instead of constructing it
|
||||
/// themselves with a `WidgetRef`, which can't satisfy the `Ref` type.
|
||||
final routerProvider = Provider<GoRouter>((ref) => buildRouter(ref));
|
||||
|
||||
GoRouter buildRouter(Ref ref) {
|
||||
return GoRouter(
|
||||
initialLocation: '/',
|
||||
|
||||
@@ -30,7 +30,7 @@ class FabledSwordTheme extends ThemeExtension<FabledSwordTheme> {
|
||||
final Color warning, error, info;
|
||||
final TextStyle display, body, mono;
|
||||
|
||||
static FabledSwordTheme fromTokens() => FabledSwordTheme(
|
||||
static FabledSwordTheme fromTokens() => const FabledSwordTheme(
|
||||
accent: FabledSwordTokens.accent,
|
||||
obsidian: FabledSwordTokens.obsidian,
|
||||
iron: FabledSwordTokens.iron,
|
||||
|
||||
@@ -11,7 +11,7 @@ import 'package:minstrel/theme/theme_data.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('home renders sections with rows', (tester) async {
|
||||
final fixture = HomeData(
|
||||
const fixture = HomeData(
|
||||
recentlyAddedAlbums: const [
|
||||
AlbumRef(id: 'a', title: 'Geogaddi', artistId: 'x', artistName: 'BoC'),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user