Make the linter happy

This commit is contained in:
Roland Geider
2026-05-07 21:39:27 +02:00
parent bfc1ee92a2
commit 39eaf9abe0
9 changed files with 99 additions and 12 deletions

View File

@@ -40,7 +40,7 @@ class MeasurementCategory extends Equatable {
);
}
MeasurementEntry findEntryById(entryId) {
MeasurementEntry findEntryById(int entryId) {
return entries.firstWhere(
(entry) => entry.id == entryId,
orElse: () => throw const NoSuchEntryException(),
@@ -57,6 +57,5 @@ class MeasurementCategory extends Equatable {
List<Object?> get props => [id, name, unit, entries];
// Helper function which makes the entries list of the toJson output null, as it isn't needed
//ignore: always_declare_return_types
static _nullValue(_) => null;
static Null _nullValue(List<MeasurementEntry> _) => null;
}

View File

@@ -28,7 +28,7 @@ BaseConfig _$BaseConfigFromJson(Map<String, dynamic> json) {
value: stringOrIntToNum(json['value']),
operation: json['operation'] as String? ?? 'r',
step: json['step'] as String? ?? 'abs',
requirements: json['requirements'] as Map<String, dynamic>? ?? null,
requirements: json['requirements'] as Map<String, dynamic>?,
);
}

View File

@@ -16,12 +16,12 @@ Widget handleImageError(
// NOTE: for the moment the other error messages are not localized
String message = '';
switch (error.runtimeType) {
case NetworkImageLoadException:
switch (error) {
case NetworkImageLoadException _:
message = 'Network error';
case HttpException:
case HttpException _:
message = 'Http error';
case FormatException:
case FormatException _:
//TODO: not sure if this is the right exception for unsupported image formats?
message = AppLocalizations.of(context).imageFormatNotSupported(imageFormat);
default:

View File

@@ -21,7 +21,7 @@ import 'package:wger/models/exercises/image.dart';
import 'package:wger/widgets/core/image.dart';
class ExerciseImageWidget extends StatelessWidget {
ExerciseImageWidget({this.image, this.height});
const ExerciseImageWidget({this.image, this.height});
final ExerciseImage? image;
final double? height;

View File

@@ -32,8 +32,8 @@ class NutritionTile extends StatelessWidget {
Expanded(
child: Column(
children: [
if (title != null) title!,
if (subtitle != null) subtitle!,
?title,
?subtitle,
],
),
),

View File

@@ -127,7 +127,7 @@ class WorkoutSessionStats extends ConsumerWidget {
final WorkoutSessionApi? _sessionApi;
final List<UserTrophy> _userPrTrophies;
WorkoutSessionStats(this._sessionApi, this._userPrTrophies, {super.key});
const WorkoutSessionStats(this._sessionApi, this._userPrTrophies, {super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {

View File

@@ -4041,6 +4041,50 @@ class MockAppLocalizations extends _i1.Mock implements _i2.AppLocalizations {
)
as String);
@override
String get serverConfigIssueTitle =>
(super.noSuchMethod(
Invocation.getter(#serverConfigIssueTitle),
returnValue: _i3.dummyValue<String>(
this,
Invocation.getter(#serverConfigIssueTitle),
),
)
as String);
@override
String get serverConfigIssueMessage =>
(super.noSuchMethod(
Invocation.getter(#serverConfigIssueMessage),
returnValue: _i3.dummyValue<String>(
this,
Invocation.getter(#serverConfigIssueMessage),
),
)
as String);
@override
String get understand =>
(super.noSuchMethod(
Invocation.getter(#understand),
returnValue: _i3.dummyValue<String>(
this,
Invocation.getter(#understand),
),
)
as String);
@override
String get viewDocumentation =>
(super.noSuchMethod(
Invocation.getter(#viewDocumentation),
returnValue: _i3.dummyValue<String>(
this,
Invocation.getter(#viewDocumentation),
),
)
as String);
@override
String exerciseNr(String? nr) =>
(super.noSuchMethod(

View File

@@ -225,6 +225,14 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
)
as _i2.AuthState);
@override
bool get serverConfigWarning =>
(super.noSuchMethod(
Invocation.getter(#serverConfigWarning),
returnValue: false,
)
as bool);
@override
_i3.Client get client =>
(super.noSuchMethod(
@@ -292,6 +300,12 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
bool get hasListeners =>
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
@override
void clearServerConfigWarning() => super.noSuchMethod(
Invocation.method(#clearServerConfigWarning, []),
returnValueForMissingStub: null,
);
@override
_i5.Future<void> setServerVersion() =>
(super.noSuchMethod(
@@ -335,6 +349,14 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider {
)
as bool);
@override
_i5.Future<bool> serverConfigSane() =>
(super.noSuchMethod(
Invocation.method(#serverConfigSane, []),
returnValue: _i5.Future<bool>.value(false),
)
as _i5.Future<bool>);
@override
_i5.Future<_i2.LoginActions> register({
required String? username,

View File

@@ -75,6 +75,14 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
)
as _i3.AuthState);
@override
bool get serverConfigWarning =>
(super.noSuchMethod(
Invocation.getter(#serverConfigWarning),
returnValue: false,
)
as bool);
@override
_i2.Client get client =>
(super.noSuchMethod(
@@ -142,6 +150,12 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
bool get hasListeners =>
(super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool);
@override
void clearServerConfigWarning() => super.noSuchMethod(
Invocation.method(#clearServerConfigWarning, []),
returnValueForMissingStub: null,
);
@override
_i5.Future<void> setServerVersion() =>
(super.noSuchMethod(
@@ -185,6 +199,14 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider {
)
as bool);
@override
_i5.Future<bool> serverConfigSane() =>
(super.noSuchMethod(
Invocation.method(#serverConfigSane, []),
returnValue: _i5.Future<bool>.value(false),
)
as _i5.Future<bool>);
@override
_i5.Future<_i3.LoginActions> register({
required String? username,