lint: enforce unawaited_futures, prefer_final_locals, etc.

This commit is contained in:
edde746
2026-04-25 12:27:28 +02:00
parent c2cd2dea37
commit feba5b6f74
52 changed files with 1072 additions and 1978 deletions
+8 -8
View File
@@ -3,8 +3,8 @@
/// to handle Plex API responses where numeric fields may arrive as strings
/// (XML-to-JSON conversion).
int? flexibleInt(Object? v) => switch (v) {
num n => n.toInt(),
String s => int.tryParse(s),
final num n => n.toInt(),
final String s => int.tryParse(s),
_ => null,
};
@@ -12,16 +12,16 @@ int? flexibleInt(Object? v) => switch (v) {
/// Returns `false` for `null` or unrecognised values.
/// Handles Plex API responses where boolean fields may arrive as integers.
bool flexibleBool(Object? v) => switch (v) {
bool b => b,
int n => n == 1,
String s => s == '1',
final bool b => b,
final int n => n == 1,
final String s => s == '1',
_ => false,
};
/// Parse a value that may be [double], [num], or [String] to [double].
double? flexibleDouble(Object? v) => switch (v) {
num n => n.toDouble(),
String s => double.tryParse(s),
final num n => n.toDouble(),
final String s => double.tryParse(s),
_ => null,
};
@@ -36,6 +36,6 @@ Object? readStringField(Map json, String key) => json[key]?.toString();
/// Returns `null` when the value is `null`.
List<dynamic>? flexibleList(Object? v) => switch (v) {
null => null,
List l => l,
final List l => l,
_ => <dynamic>[v],
};
+3 -1
View File
@@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import '../models/livetv_channel.dart';
@@ -43,5 +45,5 @@ Future<void> navigateToLiveTv(
reverseTransitionDuration: Duration.zero,
);
navigator.push<bool>(route);
unawaited(navigator.push<bool>(route));
}