mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
Increase timeout durations for API requests
This commit is contained in:
@@ -28,8 +28,8 @@ import 'package:wger/core/exceptions/http_exception.dart';
|
||||
import 'package:wger/providers/auth.dart';
|
||||
import 'package:wger/providers/helpers.dart';
|
||||
|
||||
/// initial delay for fetch retries, in milliseconds
|
||||
const FETCH_INITIAL_DELAY = 250;
|
||||
/// default timeout for GET requests
|
||||
const DEFAULT_TIMEOUT = Duration(seconds: 5);
|
||||
|
||||
/// Base provider class.
|
||||
///
|
||||
@@ -73,6 +73,7 @@ class WgerBaseProvider {
|
||||
Uri uri, {
|
||||
int maxRetries = 3,
|
||||
Duration initialDelay = const Duration(milliseconds: 250),
|
||||
Duration timeout = DEFAULT_TIMEOUT,
|
||||
String? language,
|
||||
}) async {
|
||||
int attempt = 0;
|
||||
@@ -91,7 +92,7 @@ class WgerBaseProvider {
|
||||
try {
|
||||
final response = await client
|
||||
.get(uri, headers: getDefaultHeaders(includeAuth: true, language: language))
|
||||
.timeout(const Duration(seconds: 5));
|
||||
.timeout(timeout);
|
||||
|
||||
if (response.statusCode >= 400) {
|
||||
// Retry on server errors (5xx); e.g. 502 might be transient
|
||||
@@ -119,13 +120,17 @@ class WgerBaseProvider {
|
||||
}
|
||||
|
||||
/// Fetch and retrieve the overview list of objects, returns the JSON parsed response
|
||||
Future<List<dynamic>> fetchPaginated(Uri uri, {String? language}) async {
|
||||
Future<List<dynamic>> fetchPaginated(
|
||||
Uri uri, {
|
||||
String? language,
|
||||
Duration timeout = DEFAULT_TIMEOUT,
|
||||
}) async {
|
||||
final out = [];
|
||||
var url = uri;
|
||||
var allPagesProcessed = false;
|
||||
|
||||
while (!allPagesProcessed) {
|
||||
final data = await fetch(url, language: language);
|
||||
final data = await fetch(url, language: language, timeout: timeout);
|
||||
|
||||
data['results'].forEach((e) => out.add(e));
|
||||
|
||||
|
||||
@@ -292,6 +292,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
_logger.info('Loading all exercises from API');
|
||||
final exerciseData = await baseProvider.fetchPaginated(
|
||||
baseProvider.makeUrl(exerciseUrlPath, query: {'limit': API_MAX_PAGE_SIZE}),
|
||||
timeout: const Duration(seconds: 15), // just in case
|
||||
);
|
||||
final exerciseIds = exerciseData.map<int>((e) => e['id'] as int).toSet();
|
||||
|
||||
@@ -362,8 +363,13 @@ class ExercisesProvider with ChangeNotifier {
|
||||
'Re-fetching exercise $exerciseId from API since last fetch was ${exerciseDb.lastFetched}',
|
||||
);
|
||||
|
||||
// Note: we set a very long timeout here since the exercise api endpoint might
|
||||
// take a long time to load if the exercise data has not been cached yet. A test
|
||||
// on a raspberry pi showed that this can take up to 45 seconds, so one minute
|
||||
// should be safe.
|
||||
final apiData = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(exerciseInfoUrlPath, id: exerciseId),
|
||||
timeout: const Duration(seconds: 60),
|
||||
);
|
||||
final exerciseApiData = ExerciseApiData.fromJson(apiData);
|
||||
|
||||
@@ -419,7 +425,7 @@ class ExercisesProvider with ChangeNotifier {
|
||||
return exercise;
|
||||
}
|
||||
|
||||
Future<void> initCacheTimesLocalPrefs({forceInit = false}) async {
|
||||
Future<void> initCacheTimesLocalPrefs({bool forceInit = false}) async {
|
||||
final prefs = PreferenceHelper.asyncPref;
|
||||
|
||||
final initDate = DateTime(2023, 1, 1).toIso8601String();
|
||||
|
||||
@@ -40,7 +40,7 @@ final class GymLogNotifierProvider extends $NotifierProvider<GymLogNotifier, Log
|
||||
}
|
||||
}
|
||||
|
||||
String _$gymLogNotifierHash() => r'4523975eeeaacceca4e86fb2e4ddd9a42c263d8e';
|
||||
String _$gymLogNotifierHash() => r'5e166c827248e02d55279c7022a4c5a670e9b3dc';
|
||||
|
||||
abstract class _$GymLogNotifier extends $Notifier<Log?> {
|
||||
Log? build();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (C) 2020, 2021 wger Team
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -399,7 +399,7 @@ class NutritionPlansProvider with ChangeNotifier {
|
||||
}
|
||||
|
||||
// Send the request
|
||||
_logger.info("Fetching ingredients from server");
|
||||
_logger.info('Fetching ingredients from server');
|
||||
final response = await baseProvider.fetch(
|
||||
baseProvider.makeUrl(
|
||||
_ingredientInfoPath,
|
||||
@@ -409,6 +409,7 @@ class NutritionPlansProvider with ChangeNotifier {
|
||||
'limit': API_RESULTS_PAGE_SIZE,
|
||||
},
|
||||
),
|
||||
timeout: const Duration(seconds: 10),
|
||||
);
|
||||
|
||||
return (response['results'] as List)
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/core/settings_test.dart.
|
||||
// Do not manually edit this file.
|
||||
@@ -426,7 +408,7 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider {
|
||||
as _i18.Future<_i4.Exercise>);
|
||||
|
||||
@override
|
||||
_i18.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i18.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
@@ -964,7 +946,15 @@ class MockUserProvider extends _i1.Mock implements _i21.UserProvider {
|
||||
@override
|
||||
List<_i21.DashboardWidget> get dashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#dashboardOrder),
|
||||
Invocation.getter(#dashboardWidgets),
|
||||
returnValue: <_i21.DashboardWidget>[],
|
||||
)
|
||||
as List<_i21.DashboardWidget>);
|
||||
|
||||
@override
|
||||
List<_i21.DashboardWidget> get allDashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#allDashboardWidgets),
|
||||
returnValue: <_i21.DashboardWidget>[],
|
||||
)
|
||||
as List<_i21.DashboardWidget>);
|
||||
@@ -1163,6 +1153,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -1172,6 +1163,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -1180,9 +1172,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
as _i18.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i18.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i18.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i18.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i18.Future<List<dynamic>>);
|
||||
|
||||
@@ -410,6 +410,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -419,6 +420,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -427,9 +429,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider {
|
||||
as _i14.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i14.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i14.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i14.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i14.Future<List<dynamic>>);
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/exercises/contribute_exercise_test.dart.
|
||||
// Do not manually edit this file.
|
||||
@@ -410,7 +392,15 @@ class MockUserProvider extends _i1.Mock implements _i17.UserProvider {
|
||||
@override
|
||||
List<_i17.DashboardWidget> get dashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#dashboardOrder),
|
||||
Invocation.getter(#dashboardWidgets),
|
||||
returnValue: <_i17.DashboardWidget>[],
|
||||
)
|
||||
as List<_i17.DashboardWidget>);
|
||||
|
||||
@override
|
||||
List<_i17.DashboardWidget> get allDashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#allDashboardWidgets),
|
||||
returnValue: <_i17.DashboardWidget>[],
|
||||
)
|
||||
as List<_i17.DashboardWidget>);
|
||||
@@ -820,7 +810,7 @@ class MockExercisesProvider extends _i1.Mock implements _i20.ExercisesProvider {
|
||||
as _i15.Future<_i6.Exercise>);
|
||||
|
||||
@override
|
||||
_i15.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i15.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
|
||||
@@ -151,12 +151,12 @@ void main() {
|
||||
|
||||
// Mock base info response
|
||||
when(mockBaseProvider.makeUrl(exerciseInfoUrl)).thenReturn(tExerciseInfoUri);
|
||||
when(mockBaseProvider.fetch(tExerciseInfoUri)).thenAnswer(
|
||||
when(mockBaseProvider.fetch(tExerciseInfoUri, timeout: anyNamed('timeout'))).thenAnswer(
|
||||
(_) => Future.value(tExerciseInfoMap),
|
||||
);
|
||||
|
||||
when(mockBaseProvider.makeUrl(exerciseInfoUrl, id: 9)).thenReturn(tExerciseInfoDetailUri);
|
||||
when(mockBaseProvider.fetch(tExerciseInfoDetailUri)).thenAnswer(
|
||||
when(mockBaseProvider.fetch(tExerciseInfoDetailUri, timeout: anyNamed('timeout'))).thenAnswer(
|
||||
(_) => Future.value(tExerciseInfoMap),
|
||||
);
|
||||
});
|
||||
@@ -504,7 +504,7 @@ void main() {
|
||||
)..where((e) => e.id.equals(9))).getSingleOrNull();
|
||||
|
||||
// Assert
|
||||
verify(mockBaseProvider.fetch(any));
|
||||
verify(mockBaseProvider.fetch(any, timeout: anyNamed('timeout')));
|
||||
expect(provider.exercises.length, 1);
|
||||
expect(provider.exercises.first.id, 9);
|
||||
expect(provider.exercises.first.uuid, '1b020b3a-3732-4c7e-92fd-a0cec90ed69b');
|
||||
@@ -539,7 +539,7 @@ void main() {
|
||||
final exerciseData = ExerciseApiData.fromString(exerciseDb!.data);
|
||||
|
||||
// Assert
|
||||
verify(mockBaseProvider.fetch(any));
|
||||
verify(mockBaseProvider.fetch(any, timeout: anyNamed('timeout')));
|
||||
expect(provider.exercises.length, 1);
|
||||
expect(provider.exercises.first.id, 9);
|
||||
expect(provider.exercises.first.uuid, '1b020b3a-3732-4c7e-92fd-a0cec90ed69b');
|
||||
|
||||
@@ -352,7 +352,7 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider {
|
||||
as _i10.Future<_i4.Exercise>);
|
||||
|
||||
@override
|
||||
_i10.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i10.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
|
||||
@@ -183,6 +183,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -192,6 +193,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -200,9 +202,17 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
as _i6.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i6.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i6.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i6.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i6.Future<List<dynamic>>);
|
||||
|
||||
@@ -183,6 +183,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -192,6 +193,7 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -200,9 +202,17 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider {
|
||||
as _i6.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i6.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i6.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i6.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i6.Future<List<dynamic>>);
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -130,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -139,6 +140,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -147,9 +149,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -365,6 +365,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -374,6 +375,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -382,9 +384,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -209,6 +209,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -218,6 +219,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -226,9 +228,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i20.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i20.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i20.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i20.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i20.Future<List<dynamic>>);
|
||||
@@ -563,7 +573,7 @@ class MockExercisesProvider extends _i1.Mock implements _i21.ExercisesProvider {
|
||||
as _i20.Future<_i6.Exercise>);
|
||||
|
||||
@override
|
||||
_i20.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i20.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -159,6 +159,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -168,6 +169,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -176,9 +178,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i11.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i11.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i11.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i11.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i11.Future<List<dynamic>>);
|
||||
@@ -513,7 +523,7 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider {
|
||||
as _i11.Future<_i6.Exercise>);
|
||||
|
||||
@override
|
||||
_i11.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i11.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -120,6 +120,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
Uri? uri, {
|
||||
int? maxRetries = 3,
|
||||
Duration? initialDelay = const Duration(milliseconds: 250),
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
String? language,
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
@@ -129,6 +130,7 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
{
|
||||
#maxRetries: maxRetries,
|
||||
#initialDelay: initialDelay,
|
||||
#timeout: timeout,
|
||||
#language: language,
|
||||
},
|
||||
),
|
||||
@@ -137,9 +139,17 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider {
|
||||
as _i5.Future<dynamic>);
|
||||
|
||||
@override
|
||||
_i5.Future<List<dynamic>> fetchPaginated(Uri? uri, {String? language}) =>
|
||||
_i5.Future<List<dynamic>> fetchPaginated(
|
||||
Uri? uri, {
|
||||
String? language,
|
||||
Duration? timeout = const Duration(seconds: 5),
|
||||
}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#fetchPaginated, [uri], {#language: language}),
|
||||
Invocation.method(
|
||||
#fetchPaginated,
|
||||
[uri],
|
||||
{#language: language, #timeout: timeout},
|
||||
),
|
||||
returnValue: _i5.Future<List<dynamic>>.value(<dynamic>[]),
|
||||
)
|
||||
as _i5.Future<List<dynamic>>);
|
||||
|
||||
@@ -1,21 +1,3 @@
|
||||
/*
|
||||
* This file is part of wger Workout Manager <https://github.com/wger-project>.
|
||||
* Copyright (c) 2026 wger Team
|
||||
*
|
||||
* wger Workout Manager is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Mocks generated by Mockito 5.4.6 from annotations
|
||||
// in wger/test/weight/weight_screen_test.dart.
|
||||
// Do not manually edit this file.
|
||||
@@ -252,7 +234,15 @@ class MockUserProvider extends _i1.Mock implements _i13.UserProvider {
|
||||
@override
|
||||
List<_i13.DashboardWidget> get dashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#dashboardOrder),
|
||||
Invocation.getter(#dashboardWidgets),
|
||||
returnValue: <_i13.DashboardWidget>[],
|
||||
)
|
||||
as List<_i13.DashboardWidget>);
|
||||
|
||||
@override
|
||||
List<_i13.DashboardWidget> get allDashboardWidgets =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.getter(#allDashboardWidgets),
|
||||
returnValue: <_i13.DashboardWidget>[],
|
||||
)
|
||||
as List<_i13.DashboardWidget>);
|
||||
|
||||
@@ -402,7 +402,7 @@ class MockExercisesProvider extends _i1.Mock implements _i18.ExercisesProvider {
|
||||
as _i19.Future<_i4.Exercise>);
|
||||
|
||||
@override
|
||||
_i19.Future<void> initCacheTimesLocalPrefs({dynamic forceInit = false}) =>
|
||||
_i19.Future<void> initCacheTimesLocalPrefs({bool? forceInit = false}) =>
|
||||
(super.noSuchMethod(
|
||||
Invocation.method(#initCacheTimesLocalPrefs, [], {
|
||||
#forceInit: forceInit,
|
||||
|
||||
Reference in New Issue
Block a user