From 5e22d69bb12b62cc8d8579e75556f4d8bfbf2730 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Sat, 3 May 2025 15:39:09 +0200 Subject: [PATCH 1/9] Improve error handling and logging Now we process and catch all errors that might happen in the application, instead of silently ignoring them. These errors are shown in a better error dialog, that shows the details to the user and allows to create an issue on GitHub with the error and traceback data already filled in. --- lib/helpers/ui.dart | 182 +++- lib/l10n/app_en.arb | 5 +- lib/main.dart | 52 +- lib/providers/routines.dart | 2 +- lib/screens/auth_screen.dart | 4 +- lib/screens/home_tabs_screen.dart | 129 ++- lib/widgets/measurements/forms.dart | 8 - lib/widgets/nutrition/forms.dart | 8 - lib/widgets/nutrition/widgets.dart | 12 +- lib/widgets/routines/gym_mode/log_page.dart | 5 - .../routines/gym_mode/session_page.dart | 4 - lib/widgets/weight/forms.dart | 5 +- test/auth/auth_screen_test.mocks.dart | 222 ++-- test/core/settings_test.mocks.dart | 994 +++++++++++++----- .../contribute_exercise_test.mocks.dart | 497 ++++++--- .../exercises_detail_widget_test.mocks.dart | 310 ++++-- test/gallery/gallery_form_test.mocks.dart | 223 +++- test/gallery/gallery_screen_test.mocks.dart | 223 +++- ...surement_categories_screen_test.mocks.dart | 138 ++- .../nutrition/nutritional_meal_form_test.dart | 6 +- .../nutritional_meal_form_test.mocks.dart | 344 ++++-- .../nutrition/nutritional_plan_form_test.dart | 14 +- .../nutritional_plan_form_test.mocks.dart | 344 ++++-- .../nutritional_plan_screen_test.mocks.dart | 595 +++++++---- .../nutritional_plans_screen_test.mocks.dart | 595 +++++++---- test/other/base_provider_test.mocks.dart | 222 ++-- test/weight/weight_screen_test.mocks.dart | 519 ++++++--- test/workout/day_form_test.mocks.dart | 575 +++++++--- test/workout/gym_mode_screen_test.mocks.dart | 450 ++++++-- .../workout/gym_mode_session_screen_test.dart | 4 + .../gym_mode_session_screen_test.mocks.dart | 575 +++++++--- ...epetition_unit_form_widget_test.mocks.dart | 575 +++++++--- .../routine_edit_screen_test.mocks.dart | 575 +++++++--- test/workout/routine_edit_test.mocks.dart | 575 +++++++--- test/workout/routine_form_test.mocks.dart | 575 +++++++--- .../routine_logs_screen_test.mocks.dart | 575 +++++++--- test/workout/routine_screen_test.mocks.dart | 147 ++- .../workout/routines_provider_test.mocks.dart | 450 ++++++-- test/workout/routines_screen_test.mocks.dart | 147 ++- test/workout/slot_entry_form_test.mocks.dart | 575 +++++++--- .../weight_unit_form_widget_test.mocks.dart | 575 +++++++--- 41 files changed, 8980 insertions(+), 3055 deletions(-) diff --git a/lib/helpers/ui.dart b/lib/helpers/ui.dart index ff4b73fe..8a61dc19 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/ui.dart @@ -16,37 +16,21 @@ * along with this program. If not, see . */ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:json_annotation/json_annotation.dart'; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; +import 'package:wger/main.dart'; import 'package:wger/models/workouts/log.dart'; import 'package:wger/providers/routines.dart'; -void showErrorDialog(dynamic exception, BuildContext context) { - // log('showErrorDialog: '); - // log(exception.toString()); - // log('====================='); - - showDialog( - context: context, - builder: (ctx) => AlertDialog( - scrollable: true, - title: Text(AppLocalizations.of(context).anErrorOccurred), - content: SelectableText(exception.toString()), - actions: [ - TextButton( - child: Text(MaterialLocalizations.of(context).closeButtonLabel), - onPressed: () { - Navigator.of(ctx).pop(); - }, - ), - ], - ), - ); -} - void showHttpExceptionErrorDialog( WgerHttpException exception, BuildContext context, @@ -54,7 +38,6 @@ void showHttpExceptionErrorDialog( final logger = Logger('showHttpExceptionErrorDialog'); logger.fine(exception.toString()); - logger.fine('-------------------'); final List errorList = []; @@ -103,7 +86,156 @@ void showHttpExceptionErrorDialog( // This call serves no purpose The dialog above doesn't seem to show // unless this dummy call is present - showDialog(context: context, builder: (context) => Container()); + //showDialog(context: context, builder: (context) => Container()); +} + +void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext? context}) { + // Attempt to get the BuildContext from our global navigatorKey. + // This allows us to show a dialog even if the error occurs outside + // of a widget's build method. + final BuildContext? dialogContext = context ?? navigatorKey.currentContext; + + final logger = Logger('showHttpExceptionErrorDialog'); + + if (dialogContext == null) { + if (kDebugMode) { + logger.warning('Error: Could not error show dialog because the context is null.'); + logger.warning('Original error: $error'); + logger.warning('Original stackTrace: $stackTrace'); + } + return; + } + + // Determine the error title and message based on the error type. + String errorTitle = 'An error occurred'; + String errorMessage = error.toString(); + + if (error is TimeoutException) { + errorTitle = 'Network Timeout'; + errorMessage = + 'The connection to the server timed out. Please check your internet connection and try again.'; + } else if (error is FlutterErrorDetails) { + errorTitle = 'Application Error'; + errorMessage = error.exceptionAsString(); + } else if (error is MissingRequiredKeysException) { + errorTitle = 'Missing Required Key '; + } + + final String fullStackTrace = stackTrace?.toString() ?? 'No stack trace available.'; + + final i18n = AppLocalizations.of(dialogContext); + + showDialog( + context: dialogContext, + barrierDismissible: false, + builder: (BuildContext context) { + return AlertDialog( + title: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.error, color: Theme.of(context).colorScheme.error), + const SizedBox(width: 8), + Expanded( + child: Text( + i18n.anErrorOccurred, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ), + ], + ), + content: SingleChildScrollView( + child: ListBody( + children: [ + Text(i18n.errorInfoDescription), + const SizedBox(height: 8), + Text(i18n.errorInfoDescription2), + const SizedBox(height: 10), + ExpansionTile( + tilePadding: EdgeInsets.zero, + title: Text(i18n.errorViewDetails), + children: [ + Text( + errorMessage, + style: const TextStyle(fontWeight: FontWeight.bold), + ), + Container( + alignment: Alignment.topLeft, + padding: const EdgeInsets.symmetric(vertical: 8.0), + constraints: const BoxConstraints(maxHeight: 250), + child: SingleChildScrollView( + child: Text( + fullStackTrace, + style: TextStyle(fontSize: 12.0, color: Colors.grey[700]), + ), + ), + ), + const SizedBox(height: 8), + TextButton.icon( + icon: const Icon(Icons.copy_all_outlined, size: 18), + label: Text(i18n.copyToClipboard), + style: TextButton.styleFrom( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + onPressed: () { + final String clipboardText = + 'Error Title: $errorTitle\nError Message: $errorMessage\n\nStack Trace:\n$fullStackTrace'; + Clipboard.setData(ClipboardData(text: clipboardText)).then((_) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Error details copied to clipboard!')), + ); + }).catchError((copyError) { + if (kDebugMode) logger.fine('Error copying to clipboard: $copyError'); + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Could not copy details.')), + ); + }); + }, + ), + ], + ), + ], + ), + ), + actions: [ + TextButton( + child: const Text('Report issue'), + onPressed: () async { + const githubRepoUrl = 'https://github.com/wger-project/flutter'; + final description = Uri.encodeComponent( + '## Description\n\n' + '[Please describe what you were doing when the error occurred.]\n\n' + '## Error details\n\n' + 'Error title: $errorTitle\n' + 'Error message: $errorMessage\n' + 'Stack trace:\n' + '```\n$stackTrace\n```', + ); + final githubIssueUrl = '$githubRepoUrl/issues/new?template=1_bug.yml' + '&title=$errorTitle' + '&description=$description'; + final Uri reportUri = Uri.parse(githubIssueUrl); + + try { + await launchUrl(reportUri, mode: LaunchMode.externalApplication); + } catch (e) { + if (kDebugMode) logger.warning('Error launching URL: $e'); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Error opening issue tracker: $e')), + ); + } + }, + ), + FilledButton( + child: const Text('OK'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); } void showDeleteDialog(BuildContext context, String confirmDeleteName, Log log) async { diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index a5335021..3acc19a9 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -302,7 +302,10 @@ "goalFat": "Fat goal", "goalFiber": "Fiber goal", "anErrorOccurred": "An Error Occurred!", - "@anErrorOccurred": {}, + "errorInfoDescription": "We're sorry, but something went wrong. You can help us fix this by reporting the issue on GitHub.", + "errorInfoDescription2": "You can continue using the app, but some features may not work as expected.", + "errorViewDetails": "View technical details", + "copyToClipboard": "Copy to clipboard", "weight": "Weight", "min": "Min", "max": "Max", diff --git a/lib/main.dart b/lib/main.dart index 71e7b25c..a2f1b27b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -60,6 +60,7 @@ import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/core/about.dart'; import 'package:wger/widgets/core/settings.dart'; +import 'helpers/ui.dart'; import 'providers/auth.dart'; void _setupLogging() { @@ -69,8 +70,12 @@ void _setupLogging() { }); } +final GlobalKey navigatorKey = GlobalKey(); + void main() async { _setupLogging(); + + final logger = Logger('main'); //zx.setLogEnabled(kDebugMode); // Needs to be called before runApp @@ -82,6 +87,27 @@ void main() async { // SharedPreferences to SharedPreferencesAsync migration function await PreferenceHelper.instance.migrationSupportFunctionForSharedPreferences(); + // Catch errors from Flutter itself (widget build, layout, paint, etc.) + FlutterError.onError = (FlutterErrorDetails details) { + if (kDebugMode) { + FlutterError.dumpErrorToConsole(details); + } + showGeneralErrorDialog(details.exception, details.stack ?? StackTrace.empty); + // Zone.current.handleUncaughtError(details.exception, details.stack ?? StackTrace.empty); + }; + + // Catch errors that happen outside of the Flutter framework (e.g., in async operations) + PlatformDispatcher.instance.onError = (error, stack) { + if (kDebugMode) { + logger.warning('Caught error by PlatformDispatcher: $error'); + logger.warning('Stack trace: $stack'); + } + showGeneralErrorDialog(error, stack); + + // Return true to indicate that the error has been handled. + return true; + }; + // Application runApp(const riverpod.ProviderScope(child: MainApp())); } @@ -90,18 +116,19 @@ class MainApp extends StatelessWidget { const MainApp(); Widget _getHomeScreen(AuthProvider auth) { - if (auth.state == AuthState.loggedIn) { - return HomeTabsScreen(); - } else if (auth.state == AuthState.updateRequired) { - return const UpdateAppScreen(); - } else { - return FutureBuilder( - future: auth.tryAutoLogin(), - builder: (ctx, authResultSnapshot) => - authResultSnapshot.connectionState == ConnectionState.waiting - ? const SplashScreen() - : const AuthScreen(), - ); + switch (auth.state) { + case AuthState.loggedIn: + return HomeTabsScreen(); + case AuthState.updateRequired: + return const UpdateAppScreen(); + default: + return FutureBuilder( + future: auth.tryAutoLogin(), + builder: (ctx, authResultSnapshot) => + authResultSnapshot.connectionState == ConnectionState.waiting + ? const SplashScreen() + : const AuthScreen(), + ); } } @@ -173,6 +200,7 @@ class MainApp extends StatelessWidget { builder: (ctx, auth, _) => Consumer( builder: (ctx, user, _) => MaterialApp( title: 'wger', + navigatorKey: navigatorKey, theme: wgerLightTheme, darkTheme: wgerDarkTheme, highContrastTheme: wgerLightThemeHc, diff --git a/lib/providers/routines.dart b/lib/providers/routines.dart index d61310df..341a10c2 100644 --- a/lib/providers/routines.dart +++ b/lib/providers/routines.dart @@ -18,7 +18,7 @@ import 'dart:convert'; -import 'package:flutter/material.dart'; +import 'package:flutter/foundation.dart'; import 'package:logging/logging.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index c94ce93f..218ed770 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -206,9 +206,9 @@ class _AuthCardState extends State { setState(() { _isLoading = false; }); - } catch (error) { + } catch (error, stackTrace) { if (mounted) { - showErrorDialog(error, context); + showGeneralErrorDialog(error, stackTrace, context: context); } setState(() { _isLoading = false; diff --git a/lib/screens/home_tabs_screen.dart b/lib/screens/home_tabs_screen.dart index 22ac70c5..a1792fbe 100644 --- a/lib/screens/home_tabs_screen.dart +++ b/lib/screens/home_tabs_screen.dart @@ -21,6 +21,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart'; +import 'package:wger/exceptions/http_exception.dart'; +import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight.dart'; @@ -49,6 +51,7 @@ class HomeTabsScreen extends StatefulWidget { class _HomeTabsScreenState extends State with SingleTickerProviderStateMixin { late Future _initialData; + bool _errorHandled = false; int _selectedIndex = 0; @override @@ -95,37 +98,29 @@ class _HomeTabsScreenState extends State with SingleTickerProvid nutritionPlansProvider.fetchIngredientsFromCache(), exercisesProvider.fetchAndSetInitialData(), ]); - } catch (e) { - widget._logger.warning('Exception loading base data'); - widget._logger.warning(e.toString()); + } on WgerHttpException catch (error) { + widget._logger.warning('Wger exception loading base data'); + if (mounted) { + showHttpExceptionErrorDialog(error, context); + } } // Plans, weight and gallery - widget._logger.info('Loading plans, weight, measurements and gallery'); - try { - await Future.wait([ - galleryProvider.fetchAndSetGallery(), - nutritionPlansProvider.fetchAndSetAllPlansSparse(), - routinesProvider.fetchAndSetAllPlansSparse(), - // routinesProvider.fetchAndSetAllRoutinesFull(), - weightProvider.fetchAndSetEntries(), - measurementProvider.fetchAndSetAllCategoriesAndEntries(), - ]); - } catch (e) { - widget._logger.warning('Exception loading plans, weight, measurements and gallery'); - widget._logger.info(e.toString()); - } + widget._logger.info('Loading routines, weight, measurements and gallery'); + await Future.wait([ + galleryProvider.fetchAndSetGallery(), + nutritionPlansProvider.fetchAndSetAllPlansSparse(), + routinesProvider.fetchAndSetAllPlansSparse(), + // routinesProvider.fetchAndSetAllRoutinesFull(), + weightProvider.fetchAndSetEntries(), + measurementProvider.fetchAndSetAllCategoriesAndEntries(), + ]); // Current nutritional plan widget._logger.info('Loading current nutritional plan'); - try { - if (nutritionPlansProvider.currentPlan != null) { - final plan = nutritionPlansProvider.currentPlan!; - await nutritionPlansProvider.fetchAndSetPlanFull(plan.id!); - } - } catch (e) { - widget._logger.warning('Exception loading current nutritional plan'); - widget._logger.warning(e.toString()); + if (nutritionPlansProvider.currentPlan != null) { + final plan = nutritionPlansProvider.currentPlan!; + await nutritionPlansProvider.fetchAndSetPlanFull(plan.id!); } // Current workout plan @@ -145,42 +140,64 @@ class _HomeTabsScreenState extends State with SingleTickerProvid return FutureBuilder( future: _initialData, builder: (context, snapshot) { + if (snapshot.hasError) { + // Throw the original error with the original stack trace, otherwise + // the error will only point to these lines here + if (!_errorHandled) { + _errorHandled = true; + final error = snapshot.error; + final stackTrace = snapshot.stackTrace; + + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) { + if (error != null && stackTrace != null) { + throw Error.throwWithStackTrace(error, stackTrace); + } + throw error!; + } + }); + } + + // Note that we continue to show the app, even if there was an error. + // return const Scaffold(body: LoadingWidget()); + } + if (snapshot.connectionState != ConnectionState.done) { return const Scaffold( body: LoadingWidget(), ); - } else { - return Scaffold( - body: _screenList.elementAt(_selectedIndex), - bottomNavigationBar: NavigationBar( - destinations: [ - NavigationDestination( - icon: const Icon(Icons.home), - label: AppLocalizations.of(context).labelDashboard, - ), - NavigationDestination( - icon: const Icon(Icons.fitness_center), - label: AppLocalizations.of(context).labelBottomNavWorkout, - ), - NavigationDestination( - icon: const Icon(Icons.restaurant), - label: AppLocalizations.of(context).labelBottomNavNutrition, - ), - NavigationDestination( - icon: const FaIcon(FontAwesomeIcons.weightScale, size: 20), - label: AppLocalizations.of(context).weight, - ), - NavigationDestination( - icon: const Icon(Icons.photo_library), - label: AppLocalizations.of(context).gallery, - ), - ], - onDestinationSelected: _onItemTapped, - selectedIndex: _selectedIndex, - labelBehavior: NavigationDestinationLabelBehavior.alwaysHide, - ), - ); } + + return Scaffold( + body: _screenList.elementAt(_selectedIndex), + bottomNavigationBar: NavigationBar( + destinations: [ + NavigationDestination( + icon: const Icon(Icons.home), + label: AppLocalizations.of(context).labelDashboard, + ), + NavigationDestination( + icon: const Icon(Icons.fitness_center), + label: AppLocalizations.of(context).labelBottomNavWorkout, + ), + NavigationDestination( + icon: const Icon(Icons.restaurant), + label: AppLocalizations.of(context).labelBottomNavNutrition, + ), + NavigationDestination( + icon: const FaIcon(FontAwesomeIcons.weightScale, size: 20), + label: AppLocalizations.of(context).weight, + ), + NavigationDestination( + icon: const Icon(Icons.photo_library), + label: AppLocalizations.of(context).gallery, + ), + ], + onDestinationSelected: _onItemTapped, + selectedIndex: _selectedIndex, + labelBehavior: NavigationDestinationLabelBehavior.alwaysHide, + ), + ); }, ); } diff --git a/lib/widgets/measurements/forms.dart b/lib/widgets/measurements/forms.dart index 8ab405d6..e77ec62b 100644 --- a/lib/widgets/measurements/forms.dart +++ b/lib/widgets/measurements/forms.dart @@ -125,10 +125,6 @@ class MeasurementCategoryForm extends StatelessWidget { if (context.mounted) { showHttpExceptionErrorDialog(error, context); } - } catch (error) { - if (context.mounted) { - showErrorDialog(error, context); - } } if (context.mounted) { Navigator.of(context).pop(); @@ -302,10 +298,6 @@ class MeasurementEntryForm extends StatelessWidget { if (context.mounted) { showHttpExceptionErrorDialog(error, context); } - } catch (error) { - if (context.mounted) { - showErrorDialog(error, context); - } } if (context.mounted) { Navigator.of(context).pop(); diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 60d32967..2a5ecca2 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -107,8 +107,6 @@ class MealForm extends StatelessWidget { ).editMeal(_meal); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); - } catch (error) { - showErrorDialog(error, context); } Navigator.of(context).pop(); }, @@ -414,8 +412,6 @@ class IngredientFormState extends State { widget.onSave(context, _mealItem, date); } on WgerHttpException catch (error) { showHttpExceptionErrorDialog(error, context); - } catch (error) { - showErrorDialog(error, context); } Navigator.of(context).pop(); }, @@ -696,10 +692,6 @@ class _PlanFormState extends State { if (context.mounted) { showHttpExceptionErrorDialog(error, context); } - } catch (error) { - if (context.mounted) { - showErrorDialog(error, context); - } } }, ), diff --git a/lib/widgets/nutrition/widgets.dart b/lib/widgets/nutrition/widgets.dart index 0cfd7340..730c9787 100644 --- a/lib/widgets/nutrition/widgets.dart +++ b/lib/widgets/nutrition/widgets.dart @@ -25,7 +25,6 @@ import 'package:provider/provider.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/helpers/misc.dart'; import 'package:wger/helpers/platform.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/exercises/ingredient_api.dart'; import 'package:wger/models/nutrition/ingredient.dart'; @@ -203,15 +202,10 @@ class _IngredientTypeaheadState extends State { key: const Key('scan-button'), icon: const FaIcon(FontAwesomeIcons.barcode), onPressed: () async { - try { - if (!widget.test!) { - barcode = await readerscan(context); - } - } catch (e) { - if (mounted) { - showErrorDialog(e, context); - } + if (!widget.test!) { + barcode = await readerscan(context); } + if (!mounted) { return; } diff --git a/lib/widgets/routines/gym_mode/log_page.dart b/lib/widgets/routines/gym_mode/log_page.dart index 9e2d9cce..852a037d 100644 --- a/lib/widgets/routines/gym_mode/log_page.dart +++ b/lib/widgets/routines/gym_mode/log_page.dart @@ -318,11 +318,6 @@ class _LogPageState extends State { showHttpExceptionErrorDialog(error, context); } _isSaving = false; - } catch (error) { - if (mounted) { - showErrorDialog(error, context); - } - _isSaving = false; } }, child: diff --git a/lib/widgets/routines/gym_mode/session_page.dart b/lib/widgets/routines/gym_mode/session_page.dart index 93ac2b14..956bf17f 100644 --- a/lib/widgets/routines/gym_mode/session_page.dart +++ b/lib/widgets/routines/gym_mode/session_page.dart @@ -239,10 +239,6 @@ class _SessionPageState extends State { if (mounted) { showHttpExceptionErrorDialog(error, context); } - } catch (error) { - if (mounted) { - showErrorDialog(error, context); - } } }, ), diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 11b21430..d279a918 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -181,11 +181,8 @@ class WeightForm extends StatelessWidget { if (context.mounted) { showHttpExceptionErrorDialog(error, context); } - } catch (error) { - if (context.mounted) { - showErrorDialog(error, context); - } } + if (context.mounted) { Navigator.of(context).pop(); } diff --git a/test/auth/auth_screen_test.mocks.dart b/test/auth/auth_screen_test.mocks.dart index 32b76b47..f0c573d1 100644 --- a/test/auth/auth_screen_test.mocks.dart +++ b/test/auth/auth_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/auth/auth_screen_test.dart. // Do not manually edit this file. @@ -26,12 +26,23 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: subtype_of_sealed_class class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { - _FakeStreamedResponse_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeStreamedResponse_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [Client]. @@ -43,25 +54,45 @@ class MockClient extends _i1.Mock implements _i2.Client { } @override - _i3.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#head, [url], {#headers: headers}), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method(#head, [url], {#headers: headers}), - ), + _i3.Future<_i2.Response> head( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #head, + [url], + {#headers: headers}, ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future<_i2.Response>); @override - _i3.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method(#get, [url], {#headers: headers}), - ), + _i3.Future<_i2.Response> get( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future<_i2.Response>); @override @@ -75,18 +106,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #post, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #post, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -100,18 +137,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #put, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #put, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -125,18 +168,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #patch, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #patch, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -150,29 +199,45 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #delete, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #delete, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override - _i3.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#read, [url], {#headers: headers}), - returnValue: _i3.Future.value( - _i5.dummyValue( - this, - Invocation.method(#read, [url], {#headers: headers}), - ), + _i3.Future read( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #read, + [url], + {#headers: headers}, ), + returnValue: _i3.Future.value(_i5.dummyValue( + this, + Invocation.method( + #read, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future); @override @@ -181,24 +246,35 @@ class MockClient extends _i1.Mock implements _i2.Client { Map? headers, }) => (super.noSuchMethod( - Invocation.method(#readBytes, [url], {#headers: headers}), + Invocation.method( + #readBytes, + [url], + {#headers: headers}, + ), returnValue: _i3.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), ) as _i3.Future<_i6.Uint8List>); @override _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( - Invocation.method(#send, [request]), - returnValue: _i3.Future<_i2.StreamedResponse>.value( - _FakeStreamedResponse_1( - this, - Invocation.method(#send, [request]), - ), + Invocation.method( + #send, + [request], ), + returnValue: _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( + this, + Invocation.method( + #send, + [request], + ), + )), ) as _i3.Future<_i2.StreamedResponse>); @override void close() => super.noSuchMethod( - Invocation.method(#close, []), + Invocation.method( + #close, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/core/settings_test.mocks.dart b/test/core/settings_test.mocks.dart index 540cabb8..89f76938 100644 --- a/test/core/settings_test.mocks.dart +++ b/test/core/settings_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/core/settings_test.dart. // Do not manually edit this file. @@ -44,78 +44,173 @@ import 'package:wger/providers/user.dart' as _i22; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase { - _FakeExerciseDatabase_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseDatabase_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise { - _FakeExercise_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory { - _FakeExerciseCategory_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseCategory_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeEquipment_4 extends _i1.SmartFake implements _i6.Equipment { - _FakeEquipment_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMuscle_5 extends _i1.SmartFake implements _i7.Muscle { - _FakeMuscle_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLanguage_6 extends _i1.SmartFake implements _i8.Language { - _FakeLanguage_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredientDatabase_7 extends _i1.SmartFake implements _i9.IngredientDatabase { - _FakeIngredientDatabase_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeIngredientDatabase_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeNutritionalPlan_8 extends _i1.SmartFake implements _i10.NutritionalPlan { - _FakeNutritionalPlan_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeNutritionalPlan_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMeal_9 extends _i1.SmartFake implements _i11.Meal { - _FakeMeal_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMealItem_10 extends _i1.SmartFake implements _i12.MealItem { - _FakeMealItem_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredient_11 extends _i1.SmartFake implements _i13.Ingredient { - _FakeIngredient_11(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_11( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSharedPreferencesAsync_12 extends _i1.SmartFake implements _i14.SharedPreferencesAsync { - _FakeSharedPreferencesAsync_12(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeSharedPreferencesAsync_12( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeAuthProvider_13 extends _i1.SmartFake implements _i15.AuthProvider { - _FakeAuthProvider_13(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeAuthProvider_13( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_14 extends _i1.SmartFake implements _i16.Client { - _FakeClient_14(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_14( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_15 extends _i1.SmartFake implements Uri { - _FakeUri_15(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_15( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_16 extends _i1.SmartFake implements _i16.Response { - _FakeResponse_16(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_16( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [ExercisesProvider]. @@ -144,36 +239,18 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { ), ) as _i3.ExerciseDatabase); - @override - set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i4.Exercise> get exercises => (super.noSuchMethod( Invocation.getter(#exercises), returnValue: <_i4.Exercise>[], ) as List<_i4.Exercise>); - @override - set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( - Invocation.setter(#exercises, _exercises), - returnValueForMissingStub: null, - ); - @override List<_i4.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), returnValue: <_i4.Exercise>[], ) as List<_i4.Exercise>); - @override - set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); - @override Map> get exerciseByVariation => (super.noSuchMethod( Invocation.getter(#exerciseByVariation), @@ -205,47 +282,97 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { ) as List<_i8.Language>); @override - set languages(List<_i8.Language>? languages) => super.noSuchMethod( - Invocation.setter(#languages, languages), + set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter( + #exercises, + _exercises, + ), + returnValueForMissingStub: null, + ); + + @override + set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( + Invocation.setter( + #filteredExercises, + newFilteredExercises, + ), + returnValueForMissingStub: null, + ); + + @override + set languages(List<_i8.Language>? languages) => super.noSuchMethod( + Invocation.setter( + #languages, + languages, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i18.Future setFilters(_i17.Filters? newFilters) => (super.noSuchMethod( - Invocation.method(#setFilters, [newFilters]), + Invocation.method( + #setFilters, + [newFilters], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override void initFilters() => super.noSuchMethod( - Invocation.method(#initFilters, []), + Invocation.method( + #initFilters, + [], + ), returnValueForMissingStub: null, ); @override _i18.Future findByFilters() => (super.noSuchMethod( - Invocation.method(#findByFilters, []), + Invocation.method( + #findByFilters, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i4.Exercise findExerciseById(int? id) => (super.noSuchMethod( - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), returnValue: _FakeExercise_2( this, - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), ), ) as _i4.Exercise); @@ -265,71 +392,110 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { @override _i5.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), returnValue: _FakeExerciseCategory_3( this, - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), ), ) as _i5.ExerciseCategory); @override _i6.Equipment findEquipmentById(int? id) => (super.noSuchMethod( - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), returnValue: _FakeEquipment_4( this, - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), ), ) as _i6.Equipment); @override _i7.Muscle findMuscleById(int? id) => (super.noSuchMethod( - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), returnValue: _FakeMuscle_5( this, - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), ), ) as _i7.Muscle); @override _i8.Language findLanguageById(int? id) => (super.noSuchMethod( - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), returnValue: _FakeLanguage_6( this, - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), ), ) as _i8.Language); @override _i18.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategoriesFromApi, []), + Invocation.method( + #fetchAndSetCategoriesFromApi, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetMusclesFromApi, []), + Invocation.method( + #fetchAndSetMusclesFromApi, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipmentsFromApi, []), + Invocation.method( + #fetchAndSetEquipmentsFromApi, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguagesFromApi, []), + Invocation.method( + #fetchAndSetLanguagesFromApi, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future<_i4.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetExercise, [exerciseId]), + Invocation.method( + #fetchAndSetExercise, + [exerciseId], + ), returnValue: _i18.Future<_i4.Exercise?>.value(), ) as _i18.Future<_i4.Exercise?>); @@ -339,40 +505,52 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { int? exerciseId, ) => (super.noSuchMethod( - Invocation.method(#handleUpdateExerciseFromApi, [ - database, - exerciseId, - ]), - returnValue: _i18.Future<_i4.Exercise>.value( - _FakeExercise_2( - this, - Invocation.method(#handleUpdateExerciseFromApi, [ + Invocation.method( + #handleUpdateExerciseFromApi, + [ + database, + exerciseId, + ], + ), + returnValue: _i18.Future<_i4.Exercise>.value(_FakeExercise_2( + this, + Invocation.method( + #handleUpdateExerciseFromApi, + [ database, exerciseId, - ]), + ], ), - ), + )), ) as _i18.Future<_i4.Exercise>); @override _i18.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( - Invocation.method(#initCacheTimesLocalPrefs, [], { - #forceInit: forceInit, - }), + Invocation.method( + #initCacheTimesLocalPrefs, + [], + {#forceInit: forceInit}, + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future clearAllCachesAndPrefs() => (super.noSuchMethod( - Invocation.method(#clearAllCachesAndPrefs, []), + Invocation.method( + #clearAllCachesAndPrefs, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetInitialData() => (super.noSuchMethod( - Invocation.method(#fetchAndSetInitialData, []), + Invocation.method( + #fetchAndSetInitialData, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -394,35 +572,50 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { @override _i18.Future updateExerciseCache(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#updateExerciseCache, [database]), + Invocation.method( + #updateExerciseCache, + [database], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetMuscles(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetMuscles, [database]), + Invocation.method( + #fetchAndSetMuscles, + [database], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetCategories(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategories, [database]), + Invocation.method( + #fetchAndSetCategories, + [database], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetLanguages(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguages, [database]), + Invocation.method( + #fetchAndSetLanguages, + [database], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetEquipments(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipments, [database]), + Invocation.method( + #fetchAndSetEquipments, + [database], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -437,34 +630,47 @@ class MockExercisesProvider extends _i1.Mock implements _i17.ExercisesProvider { Invocation.method( #searchExercise, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, - ), - returnValue: _i18.Future>.value( - <_i4.Exercise>[], + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), + returnValue: _i18.Future>.value(<_i4.Exercise>[]), ) as _i18.Future>); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -495,24 +701,12 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans ), ) as _i9.IngredientDatabase); - @override - set database(_i9.IngredientDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i13.Ingredient> get ingredients => (super.noSuchMethod( Invocation.getter(#ingredients), returnValue: <_i13.Ingredient>[], ) as List<_i13.Ingredient>); - @override - set ingredients(List<_i13.Ingredient>? _ingredients) => super.noSuchMethod( - Invocation.setter(#ingredients, _ingredients), - returnValueForMissingStub: null, - ); - @override List<_i10.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), @@ -520,108 +714,190 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans ) as List<_i10.NutritionalPlan>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set database(_i9.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + set ingredients(List<_i13.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter( + #ingredients, + _ingredients, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i10.NutritionalPlan findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeNutritionalPlan_8( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i10.NutritionalPlan); @override - _i11.Meal? findMealById(int? id) => - (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i11.Meal?); + _i11.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( + #findMealById, + [id], + )) as _i11.Meal?); @override _i18.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansFull, []), + Invocation.method( + #fetchAndSetAllPlansFull, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future<_i10.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: _i18.Future<_i10.NutritionalPlan>.value( - _FakeNutritionalPlan_8( - this, - Invocation.method(#fetchAndSetPlanSparse, [planId]), - ), + Invocation.method( + #fetchAndSetPlanSparse, + [planId], ), + returnValue: _i18.Future<_i10.NutritionalPlan>.value(_FakeNutritionalPlan_8( + this, + Invocation.method( + #fetchAndSetPlanSparse, + [planId], + ), + )), ) as _i18.Future<_i10.NutritionalPlan>); @override _i18.Future<_i10.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: _i18.Future<_i10.NutritionalPlan>.value( - _FakeNutritionalPlan_8( - this, - Invocation.method(#fetchAndSetPlanFull, [planId]), - ), + Invocation.method( + #fetchAndSetPlanFull, + [planId], ), + returnValue: _i18.Future<_i10.NutritionalPlan>.value(_FakeNutritionalPlan_8( + this, + Invocation.method( + #fetchAndSetPlanFull, + [planId], + ), + )), ) as _i18.Future<_i10.NutritionalPlan>); @override _i18.Future<_i10.NutritionalPlan> addPlan(_i10.NutritionalPlan? planData) => (super.noSuchMethod( - Invocation.method(#addPlan, [planData]), - returnValue: _i18.Future<_i10.NutritionalPlan>.value( - _FakeNutritionalPlan_8( - this, - Invocation.method(#addPlan, [planData]), - ), + Invocation.method( + #addPlan, + [planData], ), + returnValue: _i18.Future<_i10.NutritionalPlan>.value(_FakeNutritionalPlan_8( + this, + Invocation.method( + #addPlan, + [planData], + ), + )), ) as _i18.Future<_i10.NutritionalPlan>); @override _i18.Future editPlan(_i10.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#editPlan, [plan]), + Invocation.method( + #editPlan, + [plan], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future deletePlan(int? id) => (super.noSuchMethod( - Invocation.method(#deletePlan, [id]), + Invocation.method( + #deletePlan, + [id], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future<_i11.Meal> addMeal(_i11.Meal? meal, int? planId) => (super.noSuchMethod( - Invocation.method(#addMeal, [meal, planId]), - returnValue: _i18.Future<_i11.Meal>.value( - _FakeMeal_9(this, Invocation.method(#addMeal, [meal, planId])), + _i18.Future<_i11.Meal> addMeal( + _i11.Meal? meal, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #addMeal, + [ + meal, + planId, + ], ), + returnValue: _i18.Future<_i11.Meal>.value(_FakeMeal_9( + this, + Invocation.method( + #addMeal, + [ + meal, + planId, + ], + ), + )), ) as _i18.Future<_i11.Meal>); @override _i18.Future<_i11.Meal> editMeal(_i11.Meal? meal) => (super.noSuchMethod( - Invocation.method(#editMeal, [meal]), - returnValue: _i18.Future<_i11.Meal>.value( - _FakeMeal_9(this, Invocation.method(#editMeal, [meal])), + Invocation.method( + #editMeal, + [meal], ), + returnValue: _i18.Future<_i11.Meal>.value(_FakeMeal_9( + this, + Invocation.method( + #editMeal, + [meal], + ), + )), ) as _i18.Future<_i11.Meal>); @override _i18.Future deleteMeal(_i11.Meal? meal) => (super.noSuchMethod( - Invocation.method(#deleteMeal, [meal]), + Invocation.method( + #deleteMeal, + [meal], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -632,25 +908,41 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans _i11.Meal? meal, ) => (super.noSuchMethod( - Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: _i18.Future<_i12.MealItem>.value( - _FakeMealItem_10( - this, - Invocation.method(#addMealItem, [mealItem, meal]), - ), + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], ), + returnValue: _i18.Future<_i12.MealItem>.value(_FakeMealItem_10( + this, + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], + ), + )), ) as _i18.Future<_i12.MealItem>); @override _i18.Future deleteMealItem(_i12.MealItem? mealItem) => (super.noSuchMethod( - Invocation.method(#deleteMealItem, [mealItem]), + Invocation.method( + #deleteMealItem, + [mealItem], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future clearIngredientCache() => (super.noSuchMethod( - Invocation.method(#clearIngredientCache, []), + Invocation.method( + #clearIngredientCache, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -666,21 +958,22 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans [ingredientId], {#database: database}, ), - returnValue: _i18.Future<_i13.Ingredient>.value( - _FakeIngredient_11( - this, - Invocation.method( - #fetchIngredient, - [ingredientId], - {#database: database}, - ), + returnValue: _i18.Future<_i13.Ingredient>.value(_FakeIngredient_11( + this, + Invocation.method( + #fetchIngredient, + [ingredientId], + {#database: database}, ), - ), + )), ) as _i18.Future<_i13.Ingredient>); @override _i18.Future fetchIngredientsFromCache() => (super.noSuchMethod( - Invocation.method(#fetchIngredientsFromCache, []), + Invocation.method( + #fetchIngredientsFromCache, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -695,22 +988,30 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans Invocation.method( #searchIngredient, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), returnValue: _i18.Future>.value( - <_i21.IngredientApiSearchEntry>[], - ), + <_i21.IngredientApiSearchEntry>[]), ) as _i18.Future>); @override _i18.Future<_i13.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( - Invocation.method(#searchIngredientWithCode, [code]), + Invocation.method( + #searchIngredientWithCode, + [code], + ), returnValue: _i18.Future<_i13.Ingredient?>.value(), ) as _i18.Future<_i13.Ingredient?>); @override _i18.Future logMealToDiary(_i11.Meal? meal) => (super.noSuchMethod( - Invocation.method(#logMealToDiary, [meal]), + Invocation.method( + #logMealToDiary, + [meal], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @@ -722,50 +1023,78 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i20.NutritionPlans DateTime? dateTime, ]) => (super.noSuchMethod( - Invocation.method(#logIngredientToDiary, [ - mealItem, - planId, - dateTime, - ]), + Invocation.method( + #logIngredientToDiary, + [ + mealItem, + planId, + dateTime, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future deleteLog(int? logId, int? planId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, planId]), + _i18.Future deleteLog( + int? logId, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + planId, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future fetchAndSetLogs(_i10.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLogs, [plan]), + Invocation.method( + #fetchAndSetLogs, + [plan], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -784,12 +1113,6 @@ class MockUserProvider extends _i1.Mock implements _i22.UserProvider { returnValue: _i23.ThemeMode.system, ) as _i23.ThemeMode); - @override - set themeMode(_i23.ThemeMode? _themeMode) => super.noSuchMethod( - Invocation.setter(#themeMode, _themeMode), - returnValueForMissingStub: null, - ); - @override _i2.WgerBaseProvider get baseProvider => (super.noSuchMethod( Invocation.getter(#baseProvider), @@ -808,76 +1131,120 @@ class MockUserProvider extends _i1.Mock implements _i22.UserProvider { ), ) as _i14.SharedPreferencesAsync); + @override + set themeMode(_i23.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter( + #themeMode, + _themeMode, + ), + returnValueForMissingStub: null, + ); + @override set prefs(_i14.SharedPreferencesAsync? _prefs) => super.noSuchMethod( - Invocation.setter(#prefs, _prefs), + Invocation.setter( + #prefs, + _prefs, + ), returnValueForMissingStub: null, ); @override set profile(_i24.Profile? _profile) => super.noSuchMethod( - Invocation.setter(#profile, _profile), + Invocation.setter( + #profile, + _profile, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override void setThemeMode(_i23.ThemeMode? mode) => super.noSuchMethod( - Invocation.method(#setThemeMode, [mode]), + Invocation.method( + #setThemeMode, + [mode], + ), returnValueForMissingStub: null, ); @override _i18.Future fetchAndSetProfile() => (super.noSuchMethod( - Invocation.method(#fetchAndSetProfile, []), + Invocation.method( + #fetchAndSetProfile, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future saveProfile() => (super.noSuchMethod( - Invocation.method(#saveProfile, []), + Invocation.method( + #saveProfile, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future verifyEmail() => (super.noSuchMethod( - Invocation.method(#verifyEmail, []), + Invocation.method( + #verifyEmail, + [], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override void addListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i19.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -893,32 +1260,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { @override _i15.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_13(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_13( + this, + Invocation.getter(#auth), + ), ) as _i15.AuthProvider); - @override - set auth(_i15.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i16.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_14(this, Invocation.getter(#client)), + returnValue: _FakeClient_14( + this, + Invocation.getter(#client), + ), ) as _i16.Client); + @override + set auth(_i15.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i16.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -933,27 +1314,41 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_15( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i18.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i18.Future.value(), ) as _i18.Future); @override _i18.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i18.Future>.value([]), ) as _i18.Future>); @@ -963,10 +1358,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i18.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i18.Future>.value({}), ) as _i18.Future>); @override @@ -975,21 +1374,39 @@ class MockWgerBaseProvider extends _i1.Mock implements _i2.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i18.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i18.Future>.value({}), ) as _i18.Future>); @override - _i18.Future<_i16.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i18.Future<_i16.Response>.value( - _FakeResponse_16( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i18.Future<_i16.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i18.Future<_i16.Response>.value(_FakeResponse_16( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i18.Future<_i16.Response>); } @@ -1004,99 +1421,180 @@ class MockSharedPreferencesAsync extends _i1.Mock implements _i14.SharedPreferen @override _i18.Future> getKeys({Set? allowList}) => (super.noSuchMethod( - Invocation.method(#getKeys, [], {#allowList: allowList}), + Invocation.method( + #getKeys, + [], + {#allowList: allowList}, + ), returnValue: _i18.Future>.value({}), ) as _i18.Future>); @override _i18.Future> getAll({Set? allowList}) => (super.noSuchMethod( - Invocation.method(#getAll, [], {#allowList: allowList}), - returnValue: _i18.Future>.value( - {}, + Invocation.method( + #getAll, + [], + {#allowList: allowList}, ), + returnValue: _i18.Future>.value({}), ) as _i18.Future>); @override _i18.Future getBool(String? key) => (super.noSuchMethod( - Invocation.method(#getBool, [key]), + Invocation.method( + #getBool, + [key], + ), returnValue: _i18.Future.value(), ) as _i18.Future); @override _i18.Future getInt(String? key) => (super.noSuchMethod( - Invocation.method(#getInt, [key]), + Invocation.method( + #getInt, + [key], + ), returnValue: _i18.Future.value(), ) as _i18.Future); @override _i18.Future getDouble(String? key) => (super.noSuchMethod( - Invocation.method(#getDouble, [key]), + Invocation.method( + #getDouble, + [key], + ), returnValue: _i18.Future.value(), ) as _i18.Future); @override _i18.Future getString(String? key) => (super.noSuchMethod( - Invocation.method(#getString, [key]), + Invocation.method( + #getString, + [key], + ), returnValue: _i18.Future.value(), ) as _i18.Future); @override _i18.Future?> getStringList(String? key) => (super.noSuchMethod( - Invocation.method(#getStringList, [key]), + Invocation.method( + #getStringList, + [key], + ), returnValue: _i18.Future?>.value(), ) as _i18.Future?>); @override _i18.Future containsKey(String? key) => (super.noSuchMethod( - Invocation.method(#containsKey, [key]), + Invocation.method( + #containsKey, + [key], + ), returnValue: _i18.Future.value(false), ) as _i18.Future); @override - _i18.Future setBool(String? key, bool? value) => (super.noSuchMethod( - Invocation.method(#setBool, [key, value]), + _i18.Future setBool( + String? key, + bool? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setBool, + [ + key, + value, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future setInt(String? key, int? value) => (super.noSuchMethod( - Invocation.method(#setInt, [key, value]), + _i18.Future setInt( + String? key, + int? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setInt, + [ + key, + value, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future setDouble(String? key, double? value) => (super.noSuchMethod( - Invocation.method(#setDouble, [key, value]), + _i18.Future setDouble( + String? key, + double? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setDouble, + [ + key, + value, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future setString(String? key, String? value) => (super.noSuchMethod( - Invocation.method(#setString, [key, value]), + _i18.Future setString( + String? key, + String? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setString, + [ + key, + value, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override - _i18.Future setStringList(String? key, List? value) => (super.noSuchMethod( - Invocation.method(#setStringList, [key, value]), + _i18.Future setStringList( + String? key, + List? value, + ) => + (super.noSuchMethod( + Invocation.method( + #setStringList, + [ + key, + value, + ], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future remove(String? key) => (super.noSuchMethod( - Invocation.method(#remove, [key]), + Invocation.method( + #remove, + [key], + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); @override _i18.Future clear({Set? allowList}) => (super.noSuchMethod( - Invocation.method(#clear, [], {#allowList: allowList}), + Invocation.method( + #clear, + [], + {#allowList: allowList}, + ), returnValue: _i18.Future.value(), returnValueForMissingStub: _i18.Future.value(), ) as _i18.Future); diff --git a/test/exercises/contribute_exercise_test.mocks.dart b/test/exercises/contribute_exercise_test.mocks.dart index 6131aa6b..a3fd5dd5 100644 --- a/test/exercises/contribute_exercise_test.mocks.dart +++ b/test/exercises/contribute_exercise_test.mocks.dart @@ -1,21 +1,21 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/exercises/contribute_exercise_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i14; -import 'dart:io' as _i11; +import 'dart:io' as _i9; import 'dart:ui' as _i15; import 'package:flutter/material.dart' as _i17; import 'package:mockito/mockito.dart' as _i1; import 'package:shared_preferences/shared_preferences.dart' as _i7; import 'package:wger/models/exercises/alias.dart' as _i6; -import 'package:wger/models/exercises/category.dart' as _i10; -import 'package:wger/models/exercises/equipment.dart' as _i12; +import 'package:wger/models/exercises/category.dart' as _i13; +import 'package:wger/models/exercises/equipment.dart' as _i10; import 'package:wger/models/exercises/exercise.dart' as _i3; -import 'package:wger/models/exercises/language.dart' as _i9; -import 'package:wger/models/exercises/muscle.dart' as _i13; +import 'package:wger/models/exercises/language.dart' as _i12; +import 'package:wger/models/exercises/muscle.dart' as _i11; import 'package:wger/models/exercises/translation.dart' as _i4; import 'package:wger/models/exercises/variation.dart' as _i5; import 'package:wger/models/user/profile.dart' as _i18; @@ -38,29 +38,63 @@ import 'package:wger/providers/user.dart' as _i16; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExercise_1 extends _i1.SmartFake implements _i3.Exercise { - _FakeExercise_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeTranslation_2 extends _i1.SmartFake implements _i4.Translation { - _FakeTranslation_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeTranslation_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeVariation_3 extends _i1.SmartFake implements _i5.Variation { - _FakeVariation_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeVariation_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeAlias_4 extends _i1.SmartFake implements _i6.Alias { - _FakeAlias_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAlias_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSharedPreferencesAsync_5 extends _i1.SmartFake implements _i7.SharedPreferencesAsync { - _FakeSharedPreferencesAsync_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeSharedPreferencesAsync_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [AddExerciseProvider]. @@ -81,91 +115,30 @@ class MockAddExerciseProvider extends _i1.Mock implements _i8.AddExerciseProvide ) as _i2.WgerBaseProvider); @override - set language(_i9.Language? _language) => super.noSuchMethod( - Invocation.setter(#language, _language), - returnValueForMissingStub: null, - ); - - @override - set category(_i10.ExerciseCategory? _category) => super.noSuchMethod( - Invocation.setter(#category, _category), - returnValueForMissingStub: null, - ); - - @override - List<_i11.File> get exerciseImages => (super.noSuchMethod( + List<_i9.File> get exerciseImages => (super.noSuchMethod( Invocation.getter(#exerciseImages), - returnValue: <_i11.File>[], - ) as List<_i11.File>); + returnValue: <_i9.File>[], + ) as List<_i9.File>); @override - set exerciseNameEn(String? name) => super.noSuchMethod( - Invocation.setter(#exerciseNameEn, name), - returnValueForMissingStub: null, - ); - - @override - set exerciseNameTrans(String? name) => super.noSuchMethod( - Invocation.setter(#exerciseNameTrans, name), - returnValueForMissingStub: null, - ); - - @override - set descriptionEn(String? description) => super.noSuchMethod( - Invocation.setter(#descriptionEn, description), - returnValueForMissingStub: null, - ); - - @override - set descriptionTrans(String? description) => super.noSuchMethod( - Invocation.setter(#descriptionTrans, description), - returnValueForMissingStub: null, - ); - - @override - set alternateNamesEn(List? names) => super.noSuchMethod( - Invocation.setter(#alternateNamesEn, names), - returnValueForMissingStub: null, - ); - - @override - set alternateNamesTrans(List? names) => super.noSuchMethod( - Invocation.setter(#alternateNamesTrans, names), - returnValueForMissingStub: null, - ); - - @override - set equipment(List<_i12.Equipment>? equipment) => super.noSuchMethod( - Invocation.setter(#equipment, equipment), - returnValueForMissingStub: null, - ); - - @override - List<_i12.Equipment> get equipment => (super.noSuchMethod( + List<_i10.Equipment> get equipment => (super.noSuchMethod( Invocation.getter(#equipment), - returnValue: <_i12.Equipment>[], - ) as List<_i12.Equipment>); + returnValue: <_i10.Equipment>[], + ) as List<_i10.Equipment>); @override - bool get newVariation => - (super.noSuchMethod(Invocation.getter(#newVariation), returnValue: false) as bool); - - @override - set newVariationForExercise(int? value) => super.noSuchMethod( - Invocation.setter(#newVariationForExercise, value), - returnValueForMissingStub: null, - ); - - @override - set variationId(int? variation) => super.noSuchMethod( - Invocation.setter(#variationId, variation), - returnValueForMissingStub: null, - ); + bool get newVariation => (super.noSuchMethod( + Invocation.getter(#newVariation), + returnValue: false, + ) as bool); @override _i3.Exercise get exercise => (super.noSuchMethod( Invocation.getter(#exercise), - returnValue: _FakeExercise_1(this, Invocation.getter(#exercise)), + returnValue: _FakeExercise_1( + this, + Invocation.getter(#exercise), + ), ) as _i3.Exercise); @override @@ -189,136 +162,306 @@ class MockAddExerciseProvider extends _i1.Mock implements _i8.AddExerciseProvide @override _i5.Variation get variation => (super.noSuchMethod( Invocation.getter(#variation), - returnValue: _FakeVariation_3(this, Invocation.getter(#variation)), + returnValue: _FakeVariation_3( + this, + Invocation.getter(#variation), + ), ) as _i5.Variation); @override - List<_i13.Muscle> get primaryMuscles => (super.noSuchMethod( + List<_i11.Muscle> get primaryMuscles => (super.noSuchMethod( Invocation.getter(#primaryMuscles), - returnValue: <_i13.Muscle>[], - ) as List<_i13.Muscle>); + returnValue: <_i11.Muscle>[], + ) as List<_i11.Muscle>); @override - set primaryMuscles(List<_i13.Muscle>? muscles) => super.noSuchMethod( - Invocation.setter(#primaryMuscles, muscles), - returnValueForMissingStub: null, - ); - - @override - List<_i13.Muscle> get secondaryMuscles => (super.noSuchMethod( + List<_i11.Muscle> get secondaryMuscles => (super.noSuchMethod( Invocation.getter(#secondaryMuscles), - returnValue: <_i13.Muscle>[], - ) as List<_i13.Muscle>); + returnValue: <_i11.Muscle>[], + ) as List<_i11.Muscle>); @override - set secondaryMuscles(List<_i13.Muscle>? muscles) => super.noSuchMethod( - Invocation.setter(#secondaryMuscles, muscles), + set language(_i12.Language? _language) => super.noSuchMethod( + Invocation.setter( + #language, + _language, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set category(_i13.ExerciseCategory? _category) => super.noSuchMethod( + Invocation.setter( + #category, + _category, + ), + returnValueForMissingStub: null, + ); + + @override + set exerciseNameEn(String? name) => super.noSuchMethod( + Invocation.setter( + #exerciseNameEn, + name, + ), + returnValueForMissingStub: null, + ); + + @override + set exerciseNameTrans(String? name) => super.noSuchMethod( + Invocation.setter( + #exerciseNameTrans, + name, + ), + returnValueForMissingStub: null, + ); + + @override + set descriptionEn(String? description) => super.noSuchMethod( + Invocation.setter( + #descriptionEn, + description, + ), + returnValueForMissingStub: null, + ); + + @override + set descriptionTrans(String? description) => super.noSuchMethod( + Invocation.setter( + #descriptionTrans, + description, + ), + returnValueForMissingStub: null, + ); + + @override + set alternateNamesEn(List? names) => super.noSuchMethod( + Invocation.setter( + #alternateNamesEn, + names, + ), + returnValueForMissingStub: null, + ); + + @override + set alternateNamesTrans(List? names) => super.noSuchMethod( + Invocation.setter( + #alternateNamesTrans, + names, + ), + returnValueForMissingStub: null, + ); + + @override + set equipment(List<_i10.Equipment>? equipment) => super.noSuchMethod( + Invocation.setter( + #equipment, + equipment, + ), + returnValueForMissingStub: null, + ); + + @override + set newVariationForExercise(int? value) => super.noSuchMethod( + Invocation.setter( + #newVariationForExercise, + value, + ), + returnValueForMissingStub: null, + ); + + @override + set variationId(int? variation) => super.noSuchMethod( + Invocation.setter( + #variationId, + variation, + ), + returnValueForMissingStub: null, + ); + + @override + set primaryMuscles(List<_i11.Muscle>? muscles) => super.noSuchMethod( + Invocation.setter( + #primaryMuscles, + muscles, + ), + returnValueForMissingStub: null, + ); + + @override + set secondaryMuscles(List<_i11.Muscle>? muscles) => super.noSuchMethod( + Invocation.setter( + #secondaryMuscles, + muscles, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override - void addExerciseImages(List<_i11.File>? exercises) => super.noSuchMethod( - Invocation.method(#addExerciseImages, [exercises]), + void addExerciseImages(List<_i9.File>? exercises) => super.noSuchMethod( + Invocation.method( + #addExerciseImages, + [exercises], + ), returnValueForMissingStub: null, ); @override void removeExercise(String? path) => super.noSuchMethod( - Invocation.method(#removeExercise, [path]), + Invocation.method( + #removeExercise, + [path], + ), returnValueForMissingStub: null, ); @override void printValues() => super.noSuchMethod( - Invocation.method(#printValues, []), + Invocation.method( + #printValues, + [], + ), returnValueForMissingStub: null, ); @override _i14.Future addExercise() => (super.noSuchMethod( - Invocation.method(#addExercise, []), + Invocation.method( + #addExercise, + [], + ), returnValue: _i14.Future.value(0), ) as _i14.Future); @override _i14.Future<_i3.Exercise> addExerciseBase() => (super.noSuchMethod( - Invocation.method(#addExerciseBase, []), - returnValue: _i14.Future<_i3.Exercise>.value( - _FakeExercise_1(this, Invocation.method(#addExerciseBase, [])), + Invocation.method( + #addExerciseBase, + [], ), + returnValue: _i14.Future<_i3.Exercise>.value(_FakeExercise_1( + this, + Invocation.method( + #addExerciseBase, + [], + ), + )), ) as _i14.Future<_i3.Exercise>); @override _i14.Future<_i5.Variation> addVariation() => (super.noSuchMethod( - Invocation.method(#addVariation, []), - returnValue: _i14.Future<_i5.Variation>.value( - _FakeVariation_3(this, Invocation.method(#addVariation, [])), + Invocation.method( + #addVariation, + [], ), + returnValue: _i14.Future<_i5.Variation>.value(_FakeVariation_3( + this, + Invocation.method( + #addVariation, + [], + ), + )), ) as _i14.Future<_i5.Variation>); @override _i14.Future addImages(_i3.Exercise? exercise) => (super.noSuchMethod( - Invocation.method(#addImages, [exercise]), + Invocation.method( + #addImages, + [exercise], + ), returnValue: _i14.Future.value(), returnValueForMissingStub: _i14.Future.value(), ) as _i14.Future); @override - _i14.Future<_i4.Translation> addExerciseTranslation( - _i4.Translation? exercise, - ) => + _i14.Future<_i4.Translation> addExerciseTranslation(_i4.Translation? exercise) => (super.noSuchMethod( - Invocation.method(#addExerciseTranslation, [exercise]), - returnValue: _i14.Future<_i4.Translation>.value( - _FakeTranslation_2( - this, - Invocation.method(#addExerciseTranslation, [exercise]), - ), + Invocation.method( + #addExerciseTranslation, + [exercise], ), + returnValue: _i14.Future<_i4.Translation>.value(_FakeTranslation_2( + this, + Invocation.method( + #addExerciseTranslation, + [exercise], + ), + )), ) as _i14.Future<_i4.Translation>); @override - _i14.Future<_i6.Alias> addExerciseAlias(String? name, int? exerciseId) => (super.noSuchMethod( - Invocation.method(#addExerciseAlias, [name, exerciseId]), - returnValue: _i14.Future<_i6.Alias>.value( - _FakeAlias_4( - this, - Invocation.method(#addExerciseAlias, [name, exerciseId]), - ), + _i14.Future<_i6.Alias> addExerciseAlias( + String? name, + int? exerciseId, + ) => + (super.noSuchMethod( + Invocation.method( + #addExerciseAlias, + [ + name, + exerciseId, + ], ), + returnValue: _i14.Future<_i6.Alias>.value(_FakeAlias_4( + this, + Invocation.method( + #addExerciseAlias, + [ + name, + exerciseId, + ], + ), + )), ) as _i14.Future<_i6.Alias>); @override void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -337,12 +480,6 @@ class MockUserProvider extends _i1.Mock implements _i16.UserProvider { returnValue: _i17.ThemeMode.system, ) as _i17.ThemeMode); - @override - set themeMode(_i17.ThemeMode? _themeMode) => super.noSuchMethod( - Invocation.setter(#themeMode, _themeMode), - returnValueForMissingStub: null, - ); - @override _i2.WgerBaseProvider get baseProvider => (super.noSuchMethod( Invocation.getter(#baseProvider), @@ -361,76 +498,120 @@ class MockUserProvider extends _i1.Mock implements _i16.UserProvider { ), ) as _i7.SharedPreferencesAsync); + @override + set themeMode(_i17.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter( + #themeMode, + _themeMode, + ), + returnValueForMissingStub: null, + ); + @override set prefs(_i7.SharedPreferencesAsync? _prefs) => super.noSuchMethod( - Invocation.setter(#prefs, _prefs), + Invocation.setter( + #prefs, + _prefs, + ), returnValueForMissingStub: null, ); @override set profile(_i18.Profile? _profile) => super.noSuchMethod( - Invocation.setter(#profile, _profile), + Invocation.setter( + #profile, + _profile, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override void setThemeMode(_i17.ThemeMode? mode) => super.noSuchMethod( - Invocation.method(#setThemeMode, [mode]), + Invocation.method( + #setThemeMode, + [mode], + ), returnValueForMissingStub: null, ); @override _i14.Future fetchAndSetProfile() => (super.noSuchMethod( - Invocation.method(#fetchAndSetProfile, []), + Invocation.method( + #fetchAndSetProfile, + [], + ), returnValue: _i14.Future.value(), returnValueForMissingStub: _i14.Future.value(), ) as _i14.Future); @override _i14.Future saveProfile() => (super.noSuchMethod( - Invocation.method(#saveProfile, []), + Invocation.method( + #saveProfile, + [], + ), returnValue: _i14.Future.value(), returnValueForMissingStub: _i14.Future.value(), ) as _i14.Future); @override _i14.Future verifyEmail() => (super.noSuchMethod( - Invocation.method(#verifyEmail, []), + Invocation.method( + #verifyEmail, + [], + ), returnValue: _i14.Future.value(), returnValueForMissingStub: _i14.Future.value(), ) as _i14.Future); @override void addListener(_i15.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i15.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/exercises/exercises_detail_widget_test.mocks.dart b/test/exercises/exercises_detail_widget_test.mocks.dart index 09a9943f..62742657 100644 --- a/test/exercises/exercises_detail_widget_test.mocks.dart +++ b/test/exercises/exercises_detail_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/exercises/exercises_detail_widget_test.dart. // Do not manually edit this file. @@ -31,34 +31,73 @@ import 'package:wger/providers/exercises.dart' as _i9; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseDatabase_1 extends _i1.SmartFake implements _i3.ExerciseDatabase { - _FakeExerciseDatabase_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseDatabase_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExercise_2 extends _i1.SmartFake implements _i4.Exercise { - _FakeExercise_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseCategory_3 extends _i1.SmartFake implements _i5.ExerciseCategory { - _FakeExerciseCategory_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseCategory_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeEquipment_4 extends _i1.SmartFake implements _i6.Equipment { - _FakeEquipment_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMuscle_5 extends _i1.SmartFake implements _i7.Muscle { - _FakeMuscle_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLanguage_6 extends _i1.SmartFake implements _i8.Language { - _FakeLanguage_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [ExercisesProvider]. @@ -87,36 +126,18 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { ), ) as _i3.ExerciseDatabase); - @override - set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i4.Exercise> get exercises => (super.noSuchMethod( Invocation.getter(#exercises), returnValue: <_i4.Exercise>[], ) as List<_i4.Exercise>); - @override - set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( - Invocation.setter(#exercises, _exercises), - returnValueForMissingStub: null, - ); - @override List<_i4.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), returnValue: <_i4.Exercise>[], ) as List<_i4.Exercise>); - @override - set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); - @override Map> get exerciseByVariation => (super.noSuchMethod( Invocation.getter(#exerciseByVariation), @@ -148,47 +169,97 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { ) as List<_i8.Language>); @override - set languages(List<_i8.Language>? languages) => super.noSuchMethod( - Invocation.setter(#languages, languages), + set database(_i3.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set exercises(List<_i4.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter( + #exercises, + _exercises, + ), + returnValueForMissingStub: null, + ); + + @override + set filteredExercises(List<_i4.Exercise>? newFilteredExercises) => super.noSuchMethod( + Invocation.setter( + #filteredExercises, + newFilteredExercises, + ), + returnValueForMissingStub: null, + ); + + @override + set languages(List<_i8.Language>? languages) => super.noSuchMethod( + Invocation.setter( + #languages, + languages, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i10.Future setFilters(_i9.Filters? newFilters) => (super.noSuchMethod( - Invocation.method(#setFilters, [newFilters]), + Invocation.method( + #setFilters, + [newFilters], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override void initFilters() => super.noSuchMethod( - Invocation.method(#initFilters, []), + Invocation.method( + #initFilters, + [], + ), returnValueForMissingStub: null, ); @override _i10.Future findByFilters() => (super.noSuchMethod( - Invocation.method(#findByFilters, []), + Invocation.method( + #findByFilters, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i4.Exercise findExerciseById(int? id) => (super.noSuchMethod( - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), returnValue: _FakeExercise_2( this, - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), ), ) as _i4.Exercise); @@ -208,71 +279,110 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { @override _i5.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), returnValue: _FakeExerciseCategory_3( this, - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), ), ) as _i5.ExerciseCategory); @override _i6.Equipment findEquipmentById(int? id) => (super.noSuchMethod( - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), returnValue: _FakeEquipment_4( this, - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), ), ) as _i6.Equipment); @override _i7.Muscle findMuscleById(int? id) => (super.noSuchMethod( - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), returnValue: _FakeMuscle_5( this, - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), ), ) as _i7.Muscle); @override _i8.Language findLanguageById(int? id) => (super.noSuchMethod( - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), returnValue: _FakeLanguage_6( this, - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), ), ) as _i8.Language); @override _i10.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategoriesFromApi, []), + Invocation.method( + #fetchAndSetCategoriesFromApi, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetMusclesFromApi, []), + Invocation.method( + #fetchAndSetMusclesFromApi, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipmentsFromApi, []), + Invocation.method( + #fetchAndSetEquipmentsFromApi, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguagesFromApi, []), + Invocation.method( + #fetchAndSetLanguagesFromApi, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future<_i4.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetExercise, [exerciseId]), + Invocation.method( + #fetchAndSetExercise, + [exerciseId], + ), returnValue: _i10.Future<_i4.Exercise?>.value(), ) as _i10.Future<_i4.Exercise?>); @@ -282,40 +392,52 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { int? exerciseId, ) => (super.noSuchMethod( - Invocation.method(#handleUpdateExerciseFromApi, [ - database, - exerciseId, - ]), - returnValue: _i10.Future<_i4.Exercise>.value( - _FakeExercise_2( - this, - Invocation.method(#handleUpdateExerciseFromApi, [ + Invocation.method( + #handleUpdateExerciseFromApi, + [ + database, + exerciseId, + ], + ), + returnValue: _i10.Future<_i4.Exercise>.value(_FakeExercise_2( + this, + Invocation.method( + #handleUpdateExerciseFromApi, + [ database, exerciseId, - ]), + ], ), - ), + )), ) as _i10.Future<_i4.Exercise>); @override _i10.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( - Invocation.method(#initCacheTimesLocalPrefs, [], { - #forceInit: forceInit, - }), + Invocation.method( + #initCacheTimesLocalPrefs, + [], + {#forceInit: forceInit}, + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future clearAllCachesAndPrefs() => (super.noSuchMethod( - Invocation.method(#clearAllCachesAndPrefs, []), + Invocation.method( + #clearAllCachesAndPrefs, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetInitialData() => (super.noSuchMethod( - Invocation.method(#fetchAndSetInitialData, []), + Invocation.method( + #fetchAndSetInitialData, + [], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @@ -337,35 +459,50 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { @override _i10.Future updateExerciseCache(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#updateExerciseCache, [database]), + Invocation.method( + #updateExerciseCache, + [database], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetMuscles(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetMuscles, [database]), + Invocation.method( + #fetchAndSetMuscles, + [database], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetCategories(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategories, [database]), + Invocation.method( + #fetchAndSetCategories, + [database], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetLanguages(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguages, [database]), + Invocation.method( + #fetchAndSetLanguages, + [database], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @override _i10.Future fetchAndSetEquipments(_i3.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipments, [database]), + Invocation.method( + #fetchAndSetEquipments, + [database], + ), returnValue: _i10.Future.value(), returnValueForMissingStub: _i10.Future.value(), ) as _i10.Future); @@ -380,34 +517,47 @@ class MockExercisesProvider extends _i1.Mock implements _i9.ExercisesProvider { Invocation.method( #searchExercise, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, - ), - returnValue: _i10.Future>.value( - <_i4.Exercise>[], + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), + returnValue: _i10.Future>.value(<_i4.Exercise>[]), ) as _i10.Future>); @override void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/gallery/gallery_form_test.mocks.dart b/test/gallery/gallery_form_test.mocks.dart index d8bf09cc..4eb2014d 100644 --- a/test/gallery/gallery_form_test.mocks.dart +++ b/test/gallery/gallery_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/gallery/gallery_form_test.dart. // Do not manually edit this file. @@ -28,19 +28,43 @@ import 'package:wger/providers/gallery.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [GalleryProvider]. @@ -59,77 +83,125 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { @override set images(List<_i5.Image>? _images) => super.noSuchMethod( - Invocation.setter(#images, _images), + Invocation.setter( + #images, + _images, + ), returnValueForMissingStub: null, ); @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); @override - set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter( + #client, + _client, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod( - Invocation.method(#fetchAndSetGallery, []), + Invocation.method( + #fetchAndSetGallery, + [], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - _i6.Future addImage(_i5.Image? image, _i7.XFile? imageFile) => (super.noSuchMethod( - Invocation.method(#addImage, [image, imageFile]), + _i6.Future addImage( + _i5.Image? image, + _i7.XFile? imageFile, + ) => + (super.noSuchMethod( + Invocation.method( + #addImage, + [ + image, + imageFile, + ], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - _i6.Future editImage(_i5.Image? image, _i7.XFile? imageFile) => (super.noSuchMethod( - Invocation.method(#editImage, [image, imageFile]), + _i6.Future editImage( + _i5.Image? image, + _i7.XFile? imageFile, + ) => + (super.noSuchMethod( + Invocation.method( + #editImage, + [ + image, + imageFile, + ], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override _i6.Future deleteImage(_i5.Image? image) => (super.noSuchMethod( - Invocation.method(#deleteImage, [image]), + Invocation.method( + #deleteImage, + [image], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -144,37 +216,58 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i6.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i6.Future.value(), ) as _i6.Future); @override _i6.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i6.Future>.value([]), ) as _i6.Future>); @override - _i6.Future> post(Map? data, Uri? uri) => + _i6.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i6.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i6.Future>.value({}), ) as _i6.Future>); @override @@ -183,44 +276,74 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i6.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i6.Future>.value({}), ) as _i6.Future>); @override - _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i6.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i6.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i6.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i6.Future<_i3.Response>); @override void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/gallery/gallery_screen_test.mocks.dart b/test/gallery/gallery_screen_test.mocks.dart index d387e32e..d1c87483 100644 --- a/test/gallery/gallery_screen_test.mocks.dart +++ b/test/gallery/gallery_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/gallery/gallery_screen_test.dart. // Do not manually edit this file. @@ -28,19 +28,43 @@ import 'package:wger/providers/gallery.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [GalleryProvider]. @@ -59,77 +83,125 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { @override set images(List<_i5.Image>? _images) => super.noSuchMethod( - Invocation.setter(#images, _images), + Invocation.setter( + #images, + _images, + ), returnValueForMissingStub: null, ); @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); @override - set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter( + #client, + _client, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i6.Future fetchAndSetGallery() => (super.noSuchMethod( - Invocation.method(#fetchAndSetGallery, []), + Invocation.method( + #fetchAndSetGallery, + [], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - _i6.Future addImage(_i5.Image? image, _i7.XFile? imageFile) => (super.noSuchMethod( - Invocation.method(#addImage, [image, imageFile]), + _i6.Future addImage( + _i5.Image? image, + _i7.XFile? imageFile, + ) => + (super.noSuchMethod( + Invocation.method( + #addImage, + [ + image, + imageFile, + ], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - _i6.Future editImage(_i5.Image? image, _i7.XFile? imageFile) => (super.noSuchMethod( - Invocation.method(#editImage, [image, imageFile]), + _i6.Future editImage( + _i5.Image? image, + _i7.XFile? imageFile, + ) => + (super.noSuchMethod( + Invocation.method( + #editImage, + [ + image, + imageFile, + ], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override _i6.Future deleteImage(_i5.Image? image) => (super.noSuchMethod( - Invocation.method(#deleteImage, [image]), + Invocation.method( + #deleteImage, + [image], + ), returnValue: _i6.Future.value(), returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -144,37 +216,58 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i6.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i6.Future.value(), ) as _i6.Future); @override _i6.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i6.Future>.value([]), ) as _i6.Future>); @override - _i6.Future> post(Map? data, Uri? uri) => + _i6.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i6.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i6.Future>.value({}), ) as _i6.Future>); @override @@ -183,44 +276,74 @@ class MockGalleryProvider extends _i1.Mock implements _i4.GalleryProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i6.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i6.Future>.value({}), ) as _i6.Future>); @override - _i6.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i6.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i6.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i6.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i6.Future<_i3.Response>); @override void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/measurements/measurement_categories_screen_test.mocks.dart b/test/measurements/measurement_categories_screen_test.mocks.dart index 1504cf8a..a66979b7 100644 --- a/test/measurements/measurement_categories_screen_test.mocks.dart +++ b/test/measurements/measurement_categories_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/measurements/measurement_categories_screen_test.dart. // Do not manually edit this file. @@ -27,13 +27,23 @@ import 'package:wger/providers/measurement.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMeasurementCategory_1 extends _i1.SmartFake implements _i3.MeasurementCategory { - _FakeMeasurementCategory_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeMeasurementCategory_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [MeasurementProvider]. @@ -60,76 +70,127 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide ) as List<_i3.MeasurementCategory>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.MeasurementCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), returnValue: _FakeMeasurementCategory_1( this, - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), ), ) as _i3.MeasurementCategory); @override _i5.Future fetchAndSetCategories() => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategories, []), + Invocation.method( + #fetchAndSetCategories, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future fetchAndSetCategoryEntries(int? id) => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategoryEntries, [id]), + Invocation.method( + #fetchAndSetCategoryEntries, + [id], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future fetchAndSetAllCategoriesAndEntries() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllCategoriesAndEntries, []), + Invocation.method( + #fetchAndSetAllCategoriesAndEntries, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future addCategory(_i3.MeasurementCategory? category) => (super.noSuchMethod( - Invocation.method(#addCategory, [category]), + Invocation.method( + #addCategory, + [category], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future deleteCategory(int? id) => (super.noSuchMethod( - Invocation.method(#deleteCategory, [id]), + Invocation.method( + #deleteCategory, + [id], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future editCategory(int? id, String? newName, String? newUnit) => (super.noSuchMethod( - Invocation.method(#editCategory, [id, newName, newUnit]), + _i5.Future editCategory( + int? id, + String? newName, + String? newUnit, + ) => + (super.noSuchMethod( + Invocation.method( + #editCategory, + [ + id, + newName, + newUnit, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future addEntry(_i6.MeasurementEntry? entry) => (super.noSuchMethod( - Invocation.method(#addEntry, [entry]), + Invocation.method( + #addEntry, + [entry], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future deleteEntry(int? id, int? categoryId) => (super.noSuchMethod( - Invocation.method(#deleteEntry, [id, categoryId]), + _i5.Future deleteEntry( + int? id, + int? categoryId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteEntry, + [ + id, + categoryId, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @@ -143,38 +204,53 @@ class MockMeasurementProvider extends _i1.Mock implements _i4.MeasurementProvide DateTime? newDate, ) => (super.noSuchMethod( - Invocation.method(#editEntry, [ - id, - categoryId, - newValue, - newNotes, - newDate, - ]), + Invocation.method( + #editEntry, + [ + id, + categoryId, + newValue, + newNotes, + newDate, + ], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/nutrition/nutritional_meal_form_test.dart b/test/nutrition/nutritional_meal_form_test.dart index 6f914bb2..82daa7d8 100644 --- a/test/nutrition/nutritional_meal_form_test.dart +++ b/test/nutrition/nutritional_meal_form_test.dart @@ -41,13 +41,13 @@ void main() { var plan1 = NutritionalPlan.empty(); var meal1 = Meal(); - when(mockNutrition.editMeal(any)).thenAnswer((_) => Future.value(Meal())); - when(mockNutrition.addMeal(any, any)).thenAnswer((_) => Future.value(Meal())); - setUp(() { plan1 = getNutritionalPlan(); meal1 = plan1.meals.first; mockNutrition = MockNutritionPlansProvider(); + + when(mockNutrition.editMeal(any)).thenAnswer((_) => Future.value(Meal())); + when(mockNutrition.addMeal(any, any)).thenAnswer((_) => Future.value(Meal())); }); Widget createFormScreen(Meal meal, {locale = 'en'}) { diff --git a/test/nutrition/nutritional_meal_form_test.mocks.dart b/test/nutrition/nutritional_meal_form_test.mocks.dart index bfba00ac..a29b472d 100644 --- a/test/nutrition/nutritional_meal_form_test.mocks.dart +++ b/test/nutrition/nutritional_meal_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/nutrition/nutritional_meal_form_test.dart. // Do not manually edit this file. @@ -31,30 +31,63 @@ import 'package:wger/providers/nutrition.dart' as _i8; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase { - _FakeIngredientDatabase_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeIngredientDatabase_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan { - _FakeNutritionalPlan_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeNutritionalPlan_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMeal_3 extends _i1.SmartFake implements _i5.Meal { - _FakeMeal_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMealItem_4 extends _i1.SmartFake implements _i6.MealItem { - _FakeMealItem_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient { - _FakeIngredient_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [NutritionPlansProvider]. @@ -83,24 +116,12 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP ), ) as _i3.IngredientDatabase); - @override - set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i7.Ingredient> get ingredients => (super.noSuchMethod( Invocation.getter(#ingredients), returnValue: <_i7.Ingredient>[], ) as List<_i7.Ingredient>); - @override - set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( - Invocation.setter(#ingredients, _ingredients), - returnValueForMissingStub: null, - ); - @override List<_i4.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), @@ -108,108 +129,190 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP ) as List<_i4.NutritionalPlan>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter( + #ingredients, + _ingredients, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i4.NutritionalPlan findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeNutritionalPlan_2( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i4.NutritionalPlan); @override - _i5.Meal? findMealById(int? id) => - (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i5.Meal?); + _i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( + #findMealById, + [id], + )) as _i5.Meal?); @override _i9.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansFull, []), + Invocation.method( + #fetchAndSetAllPlansFull, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#fetchAndSetPlanSparse, [planId]), - ), + Invocation.method( + #fetchAndSetPlanSparse, + [planId], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #fetchAndSetPlanSparse, + [planId], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#fetchAndSetPlanFull, [planId]), - ), + Invocation.method( + #fetchAndSetPlanFull, + [planId], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #fetchAndSetPlanFull, + [planId], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod( - Invocation.method(#addPlan, [planData]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#addPlan, [planData]), - ), + Invocation.method( + #addPlan, + [planData], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #addPlan, + [planData], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future editPlan(_i4.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#editPlan, [plan]), + Invocation.method( + #editPlan, + [plan], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future deletePlan(int? id) => (super.noSuchMethod( - Invocation.method(#deletePlan, [id]), + Invocation.method( + #deletePlan, + [id], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => (super.noSuchMethod( - Invocation.method(#addMeal, [meal, planId]), - returnValue: _i9.Future<_i5.Meal>.value( - _FakeMeal_3(this, Invocation.method(#addMeal, [meal, planId])), + _i9.Future<_i5.Meal> addMeal( + _i5.Meal? meal, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #addMeal, + [ + meal, + planId, + ], ), + returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3( + this, + Invocation.method( + #addMeal, + [ + meal, + planId, + ], + ), + )), ) as _i9.Future<_i5.Meal>); @override _i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#editMeal, [meal]), - returnValue: _i9.Future<_i5.Meal>.value( - _FakeMeal_3(this, Invocation.method(#editMeal, [meal])), + Invocation.method( + #editMeal, + [meal], ), + returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3( + this, + Invocation.method( + #editMeal, + [meal], + ), + )), ) as _i9.Future<_i5.Meal>); @override _i9.Future deleteMeal(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#deleteMeal, [meal]), + Invocation.method( + #deleteMeal, + [meal], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -220,25 +323,41 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP _i5.Meal? meal, ) => (super.noSuchMethod( - Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: _i9.Future<_i6.MealItem>.value( - _FakeMealItem_4( - this, - Invocation.method(#addMealItem, [mealItem, meal]), - ), + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], ), + returnValue: _i9.Future<_i6.MealItem>.value(_FakeMealItem_4( + this, + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], + ), + )), ) as _i9.Future<_i6.MealItem>); @override _i9.Future deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod( - Invocation.method(#deleteMealItem, [mealItem]), + Invocation.method( + #deleteMealItem, + [mealItem], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future clearIngredientCache() => (super.noSuchMethod( - Invocation.method(#clearIngredientCache, []), + Invocation.method( + #clearIngredientCache, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -254,21 +373,22 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP [ingredientId], {#database: database}, ), - returnValue: _i9.Future<_i7.Ingredient>.value( - _FakeIngredient_5( - this, - Invocation.method( - #fetchIngredient, - [ingredientId], - {#database: database}, - ), + returnValue: _i9.Future<_i7.Ingredient>.value(_FakeIngredient_5( + this, + Invocation.method( + #fetchIngredient, + [ingredientId], + {#database: database}, ), - ), + )), ) as _i9.Future<_i7.Ingredient>); @override _i9.Future fetchIngredientsFromCache() => (super.noSuchMethod( - Invocation.method(#fetchIngredientsFromCache, []), + Invocation.method( + #fetchIngredientsFromCache, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -283,22 +403,30 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP Invocation.method( #searchIngredient, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), returnValue: _i9.Future>.value( - <_i10.IngredientApiSearchEntry>[], - ), + <_i10.IngredientApiSearchEntry>[]), ) as _i9.Future>); @override _i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( - Invocation.method(#searchIngredientWithCode, [code]), + Invocation.method( + #searchIngredientWithCode, + [code], + ), returnValue: _i9.Future<_i7.Ingredient?>.value(), ) as _i9.Future<_i7.Ingredient?>); @override _i9.Future logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#logMealToDiary, [meal]), + Invocation.method( + #logMealToDiary, + [meal], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -310,50 +438,78 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP DateTime? dateTime, ]) => (super.noSuchMethod( - Invocation.method(#logIngredientToDiary, [ - mealItem, - planId, - dateTime, - ]), + Invocation.method( + #logIngredientToDiary, + [ + mealItem, + planId, + dateTime, + ], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future deleteLog(int? logId, int? planId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, planId]), + _i9.Future deleteLog( + int? logId, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + planId, + ], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLogs, [plan]), + Invocation.method( + #fetchAndSetLogs, + [plan], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/nutrition/nutritional_plan_form_test.dart b/test/nutrition/nutritional_plan_form_test.dart index 47fae1ff..5c56634d 100644 --- a/test/nutrition/nutritional_plan_form_test.dart +++ b/test/nutrition/nutritional_plan_form_test.dart @@ -41,11 +41,11 @@ void main() { ); final plan2 = NutritionalPlan.empty(); - when(mockNutrition.editPlan(any)).thenAnswer((_) => Future.value(plan1)); - when(mockNutrition.addPlan(any)).thenAnswer((_) => Future.value(plan2)); - setUp(() { mockNutrition = MockNutritionPlansProvider(); + + when(mockNutrition.editPlan(any)).thenAnswer((_) => Future.value(plan1)); + when(mockNutrition.addPlan(any)).thenAnswer((_) => Future.value(plan1)); }); Widget createHomeScreen(NutritionalPlan plan, {locale = 'en'}) { @@ -97,7 +97,7 @@ void main() { // https://stackoverflow.com/questions/50704647/how-to-test-navigation-via-navigator-in-flutter // Detail page - //await tester.pumpAndSettle(); + // await tester.pumpAndSettle(); //expect( // find.text(('New description')), //findsOneWidget, @@ -117,8 +117,8 @@ void main() { verifyNever(mockNutrition.editPlan(any)); verify(mockNutrition.addPlan(any)); - // Detail page - await tester.pumpAndSettle(); - expect(find.text('New cool plan'), findsOneWidget, reason: 'Nutritional plan detail page'); + // TODO: detail page + // await tester.pumpAndSettle(); + // expect(find.text('New cool plan'), findsOneWidget, reason: 'Nutritional plan detail page'); }); } diff --git a/test/nutrition/nutritional_plan_form_test.mocks.dart b/test/nutrition/nutritional_plan_form_test.mocks.dart index f81cb30c..70d084f2 100644 --- a/test/nutrition/nutritional_plan_form_test.mocks.dart +++ b/test/nutrition/nutritional_plan_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/nutrition/nutritional_plan_form_test.dart. // Do not manually edit this file. @@ -31,30 +31,63 @@ import 'package:wger/providers/nutrition.dart' as _i8; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredientDatabase_1 extends _i1.SmartFake implements _i3.IngredientDatabase { - _FakeIngredientDatabase_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeIngredientDatabase_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeNutritionalPlan_2 extends _i1.SmartFake implements _i4.NutritionalPlan { - _FakeNutritionalPlan_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeNutritionalPlan_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMeal_3 extends _i1.SmartFake implements _i5.Meal { - _FakeMeal_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMealItem_4 extends _i1.SmartFake implements _i6.MealItem { - _FakeMealItem_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredient_5 extends _i1.SmartFake implements _i7.Ingredient { - _FakeIngredient_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [NutritionPlansProvider]. @@ -83,24 +116,12 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP ), ) as _i3.IngredientDatabase); - @override - set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i7.Ingredient> get ingredients => (super.noSuchMethod( Invocation.getter(#ingredients), returnValue: <_i7.Ingredient>[], ) as List<_i7.Ingredient>); - @override - set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( - Invocation.setter(#ingredients, _ingredients), - returnValueForMissingStub: null, - ); - @override List<_i4.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), @@ -108,108 +129,190 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP ) as List<_i4.NutritionalPlan>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set database(_i3.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + set ingredients(List<_i7.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter( + #ingredients, + _ingredients, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i4.NutritionalPlan findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeNutritionalPlan_2( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i4.NutritionalPlan); @override - _i5.Meal? findMealById(int? id) => - (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i5.Meal?); + _i5.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( + #findMealById, + [id], + )) as _i5.Meal?); @override _i9.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansFull, []), + Invocation.method( + #fetchAndSetAllPlansFull, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#fetchAndSetPlanSparse, [planId]), - ), + Invocation.method( + #fetchAndSetPlanSparse, + [planId], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #fetchAndSetPlanSparse, + [planId], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#fetchAndSetPlanFull, [planId]), - ), + Invocation.method( + #fetchAndSetPlanFull, + [planId], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #fetchAndSetPlanFull, + [planId], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future<_i4.NutritionalPlan> addPlan(_i4.NutritionalPlan? planData) => (super.noSuchMethod( - Invocation.method(#addPlan, [planData]), - returnValue: _i9.Future<_i4.NutritionalPlan>.value( - _FakeNutritionalPlan_2( - this, - Invocation.method(#addPlan, [planData]), - ), + Invocation.method( + #addPlan, + [planData], ), + returnValue: _i9.Future<_i4.NutritionalPlan>.value(_FakeNutritionalPlan_2( + this, + Invocation.method( + #addPlan, + [planData], + ), + )), ) as _i9.Future<_i4.NutritionalPlan>); @override _i9.Future editPlan(_i4.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#editPlan, [plan]), + Invocation.method( + #editPlan, + [plan], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future deletePlan(int? id) => (super.noSuchMethod( - Invocation.method(#deletePlan, [id]), + Invocation.method( + #deletePlan, + [id], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future<_i5.Meal> addMeal(_i5.Meal? meal, int? planId) => (super.noSuchMethod( - Invocation.method(#addMeal, [meal, planId]), - returnValue: _i9.Future<_i5.Meal>.value( - _FakeMeal_3(this, Invocation.method(#addMeal, [meal, planId])), + _i9.Future<_i5.Meal> addMeal( + _i5.Meal? meal, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #addMeal, + [ + meal, + planId, + ], ), + returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3( + this, + Invocation.method( + #addMeal, + [ + meal, + planId, + ], + ), + )), ) as _i9.Future<_i5.Meal>); @override _i9.Future<_i5.Meal> editMeal(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#editMeal, [meal]), - returnValue: _i9.Future<_i5.Meal>.value( - _FakeMeal_3(this, Invocation.method(#editMeal, [meal])), + Invocation.method( + #editMeal, + [meal], ), + returnValue: _i9.Future<_i5.Meal>.value(_FakeMeal_3( + this, + Invocation.method( + #editMeal, + [meal], + ), + )), ) as _i9.Future<_i5.Meal>); @override _i9.Future deleteMeal(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#deleteMeal, [meal]), + Invocation.method( + #deleteMeal, + [meal], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -220,25 +323,41 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP _i5.Meal? meal, ) => (super.noSuchMethod( - Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: _i9.Future<_i6.MealItem>.value( - _FakeMealItem_4( - this, - Invocation.method(#addMealItem, [mealItem, meal]), - ), + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], ), + returnValue: _i9.Future<_i6.MealItem>.value(_FakeMealItem_4( + this, + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], + ), + )), ) as _i9.Future<_i6.MealItem>); @override _i9.Future deleteMealItem(_i6.MealItem? mealItem) => (super.noSuchMethod( - Invocation.method(#deleteMealItem, [mealItem]), + Invocation.method( + #deleteMealItem, + [mealItem], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future clearIngredientCache() => (super.noSuchMethod( - Invocation.method(#clearIngredientCache, []), + Invocation.method( + #clearIngredientCache, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -254,21 +373,22 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP [ingredientId], {#database: database}, ), - returnValue: _i9.Future<_i7.Ingredient>.value( - _FakeIngredient_5( - this, - Invocation.method( - #fetchIngredient, - [ingredientId], - {#database: database}, - ), + returnValue: _i9.Future<_i7.Ingredient>.value(_FakeIngredient_5( + this, + Invocation.method( + #fetchIngredient, + [ingredientId], + {#database: database}, ), - ), + )), ) as _i9.Future<_i7.Ingredient>); @override _i9.Future fetchIngredientsFromCache() => (super.noSuchMethod( - Invocation.method(#fetchIngredientsFromCache, []), + Invocation.method( + #fetchIngredientsFromCache, + [], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -283,22 +403,30 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP Invocation.method( #searchIngredient, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), returnValue: _i9.Future>.value( - <_i10.IngredientApiSearchEntry>[], - ), + <_i10.IngredientApiSearchEntry>[]), ) as _i9.Future>); @override _i9.Future<_i7.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( - Invocation.method(#searchIngredientWithCode, [code]), + Invocation.method( + #searchIngredientWithCode, + [code], + ), returnValue: _i9.Future<_i7.Ingredient?>.value(), ) as _i9.Future<_i7.Ingredient?>); @override _i9.Future logMealToDiary(_i5.Meal? meal) => (super.noSuchMethod( - Invocation.method(#logMealToDiary, [meal]), + Invocation.method( + #logMealToDiary, + [meal], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @@ -310,50 +438,78 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i8.NutritionPlansP DateTime? dateTime, ]) => (super.noSuchMethod( - Invocation.method(#logIngredientToDiary, [ - mealItem, - planId, - dateTime, - ]), + Invocation.method( + #logIngredientToDiary, + [ + mealItem, + planId, + dateTime, + ], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future deleteLog(int? logId, int? planId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, planId]), + _i9.Future deleteLog( + int? logId, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + planId, + ], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override _i9.Future fetchAndSetLogs(_i4.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLogs, [plan]), + Invocation.method( + #fetchAndSetLogs, + [plan], + ), returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/nutrition/nutritional_plan_screen_test.mocks.dart b/test/nutrition/nutritional_plan_screen_test.mocks.dart index ef2f03d1..4f6dd8c2 100644 --- a/test/nutrition/nutritional_plan_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plan_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/nutrition/nutritional_plan_screen_test.dart. // Do not manually edit this file. @@ -30,24 +30,53 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i3.StreamedResponse { - _FakeStreamedResponse_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeStreamedResponse_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WgerBaseProvider]. @@ -61,32 +90,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); + @override + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -101,37 +144,58 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i5.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); @override - _i5.Future> post(Map? data, Uri? uri) => + _i5.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override @@ -140,21 +204,39 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override - _i5.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i5.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i5.Future<_i3.Response>); } @@ -166,107 +248,153 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { _i1.throwOnMissingStub(this); } - @override - set token(String? _token) => super.noSuchMethod( - Invocation.setter(#token, _token), - returnValueForMissingStub: null, - ); - - @override - set serverUrl(String? _serverUrl) => super.noSuchMethod( - Invocation.setter(#serverUrl, _serverUrl), - returnValueForMissingStub: null, - ); - - @override - set serverVersion(String? _serverVersion) => super.noSuchMethod( - Invocation.setter(#serverVersion, _serverVersion), - returnValueForMissingStub: null, - ); - - @override - set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod( - Invocation.setter(#applicationVersion, _applicationVersion), - returnValueForMissingStub: null, - ); - @override Map get metadata => (super.noSuchMethod( Invocation.getter(#metadata), returnValue: {}, ) as Map); - @override - set metadata(Map? _metadata) => super.noSuchMethod( - Invocation.setter(#metadata, _metadata), - returnValueForMissingStub: null, - ); - @override _i2.AuthState get state => (super.noSuchMethod( Invocation.getter(#state), returnValue: _i2.AuthState.updateRequired, ) as _i2.AuthState); - @override - set state(_i2.AuthState? _state) => super.noSuchMethod( - Invocation.setter(#state, _state), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); @override - set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + bool get dataInit => (super.noSuchMethod( + Invocation.getter(#dataInit), + returnValue: false, + ) as bool); + + @override + bool get isAuth => (super.noSuchMethod( + Invocation.getter(#isAuth), + returnValue: false, + ) as bool); + + @override + set token(String? _token) => super.noSuchMethod( + Invocation.setter( + #token, + _token, + ), returnValueForMissingStub: null, ); @override - bool get dataInit => - (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) as bool); + set serverUrl(String? _serverUrl) => super.noSuchMethod( + Invocation.setter( + #serverUrl, + _serverUrl, + ), + returnValueForMissingStub: null, + ); + + @override + set serverVersion(String? _serverVersion) => super.noSuchMethod( + Invocation.setter( + #serverVersion, + _serverVersion, + ), + returnValueForMissingStub: null, + ); + + @override + set applicationVersion(_i6.PackageInfo? _applicationVersion) => super.noSuchMethod( + Invocation.setter( + #applicationVersion, + _applicationVersion, + ), + returnValueForMissingStub: null, + ); + + @override + set metadata(Map? _metadata) => super.noSuchMethod( + Invocation.setter( + #metadata, + _metadata, + ), + returnValueForMissingStub: null, + ); + + @override + set state(_i2.AuthState? _state) => super.noSuchMethod( + Invocation.setter( + #state, + _state, + ), + returnValueForMissingStub: null, + ); + + @override + set client(_i3.Client? _client) => super.noSuchMethod( + Invocation.setter( + #client, + _client, + ), + returnValueForMissingStub: null, + ); @override set dataInit(bool? _dataInit) => super.noSuchMethod( - Invocation.setter(#dataInit, _dataInit), + Invocation.setter( + #dataInit, + _dataInit, + ), returnValueForMissingStub: null, ); @override - bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool); - - @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i5.Future setServerVersion() => (super.noSuchMethod( - Invocation.method(#setServerVersion, []), + Invocation.method( + #setServerVersion, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setApplicationVersion() => (super.noSuchMethod( - Invocation.method(#setApplicationVersion, []), + Invocation.method( + #setApplicationVersion, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future initVersions(String? serverUrl) => (super.noSuchMethod( - Invocation.method(#initVersions, [serverUrl]), + Invocation.method( + #initVersions, + [serverUrl], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future applicationUpdateRequired([String? version]) => (super.noSuchMethod( - Invocation.method(#applicationUpdateRequired, [version]), + Invocation.method( + #applicationUpdateRequired, + [version], + ), returnValue: _i5.Future.value(false), ) as _i5.Future); @@ -279,16 +407,18 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { String? locale = 'en', }) => (super.noSuchMethod( - Invocation.method(#register, [], { - #username: username, - #password: password, - #email: email, - #serverUrl: serverUrl, - #locale: locale, - }), - returnValue: _i5.Future<_i2.LoginActions>.value( - _i2.LoginActions.update, + Invocation.method( + #register, + [], + { + #username: username, + #password: password, + #email: email, + #serverUrl: serverUrl, + #locale: locale, + }, ), + returnValue: _i5.Future<_i2.LoginActions>.value(_i2.LoginActions.update), ) as _i5.Future<_i2.LoginActions>); @override @@ -298,67 +428,101 @@ class MockAuthProvider extends _i1.Mock implements _i2.AuthProvider { String? serverUrl, ) => (super.noSuchMethod( - Invocation.method(#login, [username, password, serverUrl]), - returnValue: _i5.Future<_i2.LoginActions>.value( - _i2.LoginActions.update, + Invocation.method( + #login, + [ + username, + password, + serverUrl, + ], ), + returnValue: _i5.Future<_i2.LoginActions>.value(_i2.LoginActions.update), ) as _i5.Future<_i2.LoginActions>); @override _i5.Future getServerUrlFromPrefs() => (super.noSuchMethod( - Invocation.method(#getServerUrlFromPrefs, []), - returnValue: _i5.Future.value( - _i7.dummyValue( - this, - Invocation.method(#getServerUrlFromPrefs, []), - ), + Invocation.method( + #getServerUrlFromPrefs, + [], ), + returnValue: _i5.Future.value(_i7.dummyValue( + this, + Invocation.method( + #getServerUrlFromPrefs, + [], + ), + )), ) as _i5.Future); @override _i5.Future tryAutoLogin() => (super.noSuchMethod( - Invocation.method(#tryAutoLogin, []), + Invocation.method( + #tryAutoLogin, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future logout({bool? shouldNotify = true}) => (super.noSuchMethod( - Invocation.method(#logout, [], {#shouldNotify: shouldNotify}), + Invocation.method( + #logout, + [], + {#shouldNotify: shouldNotify}, + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override String getAppNameHeader() => (super.noSuchMethod( - Invocation.method(#getAppNameHeader, []), + Invocation.method( + #getAppNameHeader, + [], + ), returnValue: _i7.dummyValue( this, - Invocation.method(#getAppNameHeader, []), + Invocation.method( + #getAppNameHeader, + [], + ), ), ) as String); @override void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -372,25 +536,45 @@ class MockClient extends _i1.Mock implements _i3.Client { } @override - _i5.Future<_i3.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#head, [url], {#headers: headers}), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#head, [url], {#headers: headers}), - ), + _i5.Future<_i3.Response> head( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #head, + [url], + {#headers: headers}, ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future<_i3.Response>); @override - _i5.Future<_i3.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#get, [url], {#headers: headers}), - ), + _i5.Future<_i3.Response> get( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future<_i3.Response>); @override @@ -404,18 +588,24 @@ class MockClient extends _i1.Mock implements _i3.Client { Invocation.method( #post, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #post, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i3.Response>); @override @@ -429,18 +619,24 @@ class MockClient extends _i1.Mock implements _i3.Client { Invocation.method( #put, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #put, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i3.Response>); @override @@ -454,18 +650,24 @@ class MockClient extends _i1.Mock implements _i3.Client { Invocation.method( #patch, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #patch, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i3.Response>); @override @@ -479,29 +681,45 @@ class MockClient extends _i1.Mock implements _i3.Client { Invocation.method( #delete, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #delete, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i3.Response>); @override - _i5.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#read, [url], {#headers: headers}), - returnValue: _i5.Future.value( - _i7.dummyValue( - this, - Invocation.method(#read, [url], {#headers: headers}), - ), + _i5.Future read( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #read, + [url], + {#headers: headers}, ), + returnValue: _i5.Future.value(_i7.dummyValue( + this, + Invocation.method( + #read, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future); @override @@ -510,24 +728,35 @@ class MockClient extends _i1.Mock implements _i3.Client { Map? headers, }) => (super.noSuchMethod( - Invocation.method(#readBytes, [url], {#headers: headers}), + Invocation.method( + #readBytes, + [url], + {#headers: headers}, + ), returnValue: _i5.Future<_i10.Uint8List>.value(_i10.Uint8List(0)), ) as _i5.Future<_i10.Uint8List>); @override _i5.Future<_i3.StreamedResponse> send(_i3.BaseRequest? request) => (super.noSuchMethod( - Invocation.method(#send, [request]), - returnValue: _i5.Future<_i3.StreamedResponse>.value( - _FakeStreamedResponse_4( - this, - Invocation.method(#send, [request]), - ), + Invocation.method( + #send, + [request], ), + returnValue: _i5.Future<_i3.StreamedResponse>.value(_FakeStreamedResponse_4( + this, + Invocation.method( + #send, + [request], + ), + )), ) as _i5.Future<_i3.StreamedResponse>); @override void close() => super.noSuchMethod( - Invocation.method(#close, []), + Invocation.method( + #close, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/nutrition/nutritional_plans_screen_test.mocks.dart b/test/nutrition/nutritional_plans_screen_test.mocks.dart index f37db6da..cda2dde8 100644 --- a/test/nutrition/nutritional_plans_screen_test.mocks.dart +++ b/test/nutrition/nutritional_plans_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/nutrition/nutritional_plans_screen_test.dart. // Do not manually edit this file. @@ -30,24 +30,53 @@ import 'package:wger/providers/base_provider.dart' as _i8; // ignore_for_file: subtype_of_sealed_class class _FakeClient_0 extends _i1.SmartFake implements _i2.Client { - _FakeClient_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeAuthProvider_1 extends _i1.SmartFake implements _i3.AuthProvider { - _FakeAuthProvider_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeStreamedResponse_4 extends _i1.SmartFake implements _i2.StreamedResponse { - _FakeStreamedResponse_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeStreamedResponse_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [AuthProvider]. @@ -58,107 +87,153 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { _i1.throwOnMissingStub(this); } - @override - set token(String? _token) => super.noSuchMethod( - Invocation.setter(#token, _token), - returnValueForMissingStub: null, - ); - - @override - set serverUrl(String? _serverUrl) => super.noSuchMethod( - Invocation.setter(#serverUrl, _serverUrl), - returnValueForMissingStub: null, - ); - - @override - set serverVersion(String? _serverVersion) => super.noSuchMethod( - Invocation.setter(#serverVersion, _serverVersion), - returnValueForMissingStub: null, - ); - - @override - set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod( - Invocation.setter(#applicationVersion, _applicationVersion), - returnValueForMissingStub: null, - ); - @override Map get metadata => (super.noSuchMethod( Invocation.getter(#metadata), returnValue: {}, ) as Map); - @override - set metadata(Map? _metadata) => super.noSuchMethod( - Invocation.setter(#metadata, _metadata), - returnValueForMissingStub: null, - ); - @override _i3.AuthState get state => (super.noSuchMethod( Invocation.getter(#state), returnValue: _i3.AuthState.updateRequired, ) as _i3.AuthState); - @override - set state(_i3.AuthState? _state) => super.noSuchMethod( - Invocation.setter(#state, _state), - returnValueForMissingStub: null, - ); - @override _i2.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_0(this, Invocation.getter(#client)), + returnValue: _FakeClient_0( + this, + Invocation.getter(#client), + ), ) as _i2.Client); @override - set client(_i2.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + bool get dataInit => (super.noSuchMethod( + Invocation.getter(#dataInit), + returnValue: false, + ) as bool); + + @override + bool get isAuth => (super.noSuchMethod( + Invocation.getter(#isAuth), + returnValue: false, + ) as bool); + + @override + set token(String? _token) => super.noSuchMethod( + Invocation.setter( + #token, + _token, + ), returnValueForMissingStub: null, ); @override - bool get dataInit => - (super.noSuchMethod(Invocation.getter(#dataInit), returnValue: false) as bool); + set serverUrl(String? _serverUrl) => super.noSuchMethod( + Invocation.setter( + #serverUrl, + _serverUrl, + ), + returnValueForMissingStub: null, + ); + + @override + set serverVersion(String? _serverVersion) => super.noSuchMethod( + Invocation.setter( + #serverVersion, + _serverVersion, + ), + returnValueForMissingStub: null, + ); + + @override + set applicationVersion(_i4.PackageInfo? _applicationVersion) => super.noSuchMethod( + Invocation.setter( + #applicationVersion, + _applicationVersion, + ), + returnValueForMissingStub: null, + ); + + @override + set metadata(Map? _metadata) => super.noSuchMethod( + Invocation.setter( + #metadata, + _metadata, + ), + returnValueForMissingStub: null, + ); + + @override + set state(_i3.AuthState? _state) => super.noSuchMethod( + Invocation.setter( + #state, + _state, + ), + returnValueForMissingStub: null, + ); + + @override + set client(_i2.Client? _client) => super.noSuchMethod( + Invocation.setter( + #client, + _client, + ), + returnValueForMissingStub: null, + ); @override set dataInit(bool? _dataInit) => super.noSuchMethod( - Invocation.setter(#dataInit, _dataInit), + Invocation.setter( + #dataInit, + _dataInit, + ), returnValueForMissingStub: null, ); @override - bool get isAuth => (super.noSuchMethod(Invocation.getter(#isAuth), returnValue: false) as bool); - - @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i5.Future setServerVersion() => (super.noSuchMethod( - Invocation.method(#setServerVersion, []), + Invocation.method( + #setServerVersion, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future setApplicationVersion() => (super.noSuchMethod( - Invocation.method(#setApplicationVersion, []), + Invocation.method( + #setApplicationVersion, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future initVersions(String? serverUrl) => (super.noSuchMethod( - Invocation.method(#initVersions, [serverUrl]), + Invocation.method( + #initVersions, + [serverUrl], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future applicationUpdateRequired([String? version]) => (super.noSuchMethod( - Invocation.method(#applicationUpdateRequired, [version]), + Invocation.method( + #applicationUpdateRequired, + [version], + ), returnValue: _i5.Future.value(false), ) as _i5.Future); @@ -171,16 +246,18 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { String? locale = 'en', }) => (super.noSuchMethod( - Invocation.method(#register, [], { - #username: username, - #password: password, - #email: email, - #serverUrl: serverUrl, - #locale: locale, - }), - returnValue: _i5.Future<_i3.LoginActions>.value( - _i3.LoginActions.update, + Invocation.method( + #register, + [], + { + #username: username, + #password: password, + #email: email, + #serverUrl: serverUrl, + #locale: locale, + }, ), + returnValue: _i5.Future<_i3.LoginActions>.value(_i3.LoginActions.update), ) as _i5.Future<_i3.LoginActions>); @override @@ -190,67 +267,101 @@ class MockAuthProvider extends _i1.Mock implements _i3.AuthProvider { String? serverUrl, ) => (super.noSuchMethod( - Invocation.method(#login, [username, password, serverUrl]), - returnValue: _i5.Future<_i3.LoginActions>.value( - _i3.LoginActions.update, + Invocation.method( + #login, + [ + username, + password, + serverUrl, + ], ), + returnValue: _i5.Future<_i3.LoginActions>.value(_i3.LoginActions.update), ) as _i5.Future<_i3.LoginActions>); @override _i5.Future getServerUrlFromPrefs() => (super.noSuchMethod( - Invocation.method(#getServerUrlFromPrefs, []), - returnValue: _i5.Future.value( - _i6.dummyValue( - this, - Invocation.method(#getServerUrlFromPrefs, []), - ), + Invocation.method( + #getServerUrlFromPrefs, + [], ), + returnValue: _i5.Future.value(_i6.dummyValue( + this, + Invocation.method( + #getServerUrlFromPrefs, + [], + ), + )), ) as _i5.Future); @override _i5.Future tryAutoLogin() => (super.noSuchMethod( - Invocation.method(#tryAutoLogin, []), + Invocation.method( + #tryAutoLogin, + [], + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override _i5.Future logout({bool? shouldNotify = true}) => (super.noSuchMethod( - Invocation.method(#logout, [], {#shouldNotify: shouldNotify}), + Invocation.method( + #logout, + [], + {#shouldNotify: shouldNotify}, + ), returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override String getAppNameHeader() => (super.noSuchMethod( - Invocation.method(#getAppNameHeader, []), + Invocation.method( + #getAppNameHeader, + [], + ), returnValue: _i6.dummyValue( this, - Invocation.method(#getAppNameHeader, []), + Invocation.method( + #getAppNameHeader, + [], + ), ), ) as String); @override void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -266,32 +377,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider { @override _i3.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_1(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_1( + this, + Invocation.getter(#auth), + ), ) as _i3.AuthProvider); - @override - set auth(_i3.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i2.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_0(this, Invocation.getter(#client)), + returnValue: _FakeClient_0( + this, + Invocation.getter(#client), + ), ) as _i2.Client); + @override + set auth(_i3.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i2.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -306,37 +431,58 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i5.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); @override - _i5.Future> post(Map? data, Uri? uri) => + _i5.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override @@ -345,21 +491,39 @@ class MockWgerBaseProvider extends _i1.Mock implements _i8.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override - _i5.Future<_i2.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i5.Future<_i2.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i5.Future<_i2.Response>); } @@ -372,25 +536,45 @@ class MockClient extends _i1.Mock implements _i2.Client { } @override - _i5.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#head, [url], {#headers: headers}), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#head, [url], {#headers: headers}), - ), + _i5.Future<_i2.Response> head( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #head, + [url], + {#headers: headers}, ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future<_i2.Response>); @override - _i5.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#get, [url], {#headers: headers}), - ), + _i5.Future<_i2.Response> get( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future<_i2.Response>); @override @@ -404,18 +588,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #post, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #post, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i2.Response>); @override @@ -429,18 +619,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #put, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #put, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i2.Response>); @override @@ -454,18 +650,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #patch, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #patch, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i2.Response>); @override @@ -479,29 +681,45 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #delete, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i5.Future<_i2.Response>.value( - _FakeResponse_3( - this, - Invocation.method( - #delete, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i5.Future<_i2.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i5.Future<_i2.Response>); @override - _i5.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#read, [url], {#headers: headers}), - returnValue: _i5.Future.value( - _i6.dummyValue( - this, - Invocation.method(#read, [url], {#headers: headers}), - ), + _i5.Future read( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #read, + [url], + {#headers: headers}, ), + returnValue: _i5.Future.value(_i6.dummyValue( + this, + Invocation.method( + #read, + [url], + {#headers: headers}, + ), + )), ) as _i5.Future); @override @@ -510,24 +728,35 @@ class MockClient extends _i1.Mock implements _i2.Client { Map? headers, }) => (super.noSuchMethod( - Invocation.method(#readBytes, [url], {#headers: headers}), + Invocation.method( + #readBytes, + [url], + {#headers: headers}, + ), returnValue: _i5.Future<_i10.Uint8List>.value(_i10.Uint8List(0)), ) as _i5.Future<_i10.Uint8List>); @override _i5.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( - Invocation.method(#send, [request]), - returnValue: _i5.Future<_i2.StreamedResponse>.value( - _FakeStreamedResponse_4( - this, - Invocation.method(#send, [request]), - ), + Invocation.method( + #send, + [request], ), + returnValue: _i5.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_4( + this, + Invocation.method( + #send, + [request], + ), + )), ) as _i5.Future<_i2.StreamedResponse>); @override void close() => super.noSuchMethod( - Invocation.method(#close, []), + Invocation.method( + #close, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/other/base_provider_test.mocks.dart b/test/other/base_provider_test.mocks.dart index 8d6e705f..381dd975 100644 --- a/test/other/base_provider_test.mocks.dart +++ b/test/other/base_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/other/base_provider_test.dart. // Do not manually edit this file. @@ -26,12 +26,23 @@ import 'package:mockito/src/dummies.dart' as _i5; // ignore_for_file: subtype_of_sealed_class class _FakeResponse_0 extends _i1.SmartFake implements _i2.Response { - _FakeResponse_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeStreamedResponse_1 extends _i1.SmartFake implements _i2.StreamedResponse { - _FakeStreamedResponse_1(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeStreamedResponse_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [Client]. @@ -43,25 +54,45 @@ class MockClient extends _i1.Mock implements _i2.Client { } @override - _i3.Future<_i2.Response> head(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#head, [url], {#headers: headers}), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method(#head, [url], {#headers: headers}), - ), + _i3.Future<_i2.Response> head( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #head, + [url], + {#headers: headers}, ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #head, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future<_i2.Response>); @override - _i3.Future<_i2.Response> get(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#get, [url], {#headers: headers}), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method(#get, [url], {#headers: headers}), - ), + _i3.Future<_i2.Response> get( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #get, + [url], + {#headers: headers}, ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #get, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future<_i2.Response>); @override @@ -75,18 +106,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #post, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #post, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #post, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -100,18 +137,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #put, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #put, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #put, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -125,18 +168,24 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #patch, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #patch, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #patch, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override @@ -150,29 +199,45 @@ class MockClient extends _i1.Mock implements _i2.Client { Invocation.method( #delete, [url], - {#headers: headers, #body: body, #encoding: encoding}, + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - returnValue: _i3.Future<_i2.Response>.value( - _FakeResponse_0( - this, - Invocation.method( - #delete, - [url], - {#headers: headers, #body: body, #encoding: encoding}, - ), + returnValue: _i3.Future<_i2.Response>.value(_FakeResponse_0( + this, + Invocation.method( + #delete, + [url], + { + #headers: headers, + #body: body, + #encoding: encoding, + }, ), - ), + )), ) as _i3.Future<_i2.Response>); @override - _i3.Future read(Uri? url, {Map? headers}) => (super.noSuchMethod( - Invocation.method(#read, [url], {#headers: headers}), - returnValue: _i3.Future.value( - _i5.dummyValue( - this, - Invocation.method(#read, [url], {#headers: headers}), - ), + _i3.Future read( + Uri? url, { + Map? headers, + }) => + (super.noSuchMethod( + Invocation.method( + #read, + [url], + {#headers: headers}, ), + returnValue: _i3.Future.value(_i5.dummyValue( + this, + Invocation.method( + #read, + [url], + {#headers: headers}, + ), + )), ) as _i3.Future); @override @@ -181,24 +246,35 @@ class MockClient extends _i1.Mock implements _i2.Client { Map? headers, }) => (super.noSuchMethod( - Invocation.method(#readBytes, [url], {#headers: headers}), + Invocation.method( + #readBytes, + [url], + {#headers: headers}, + ), returnValue: _i3.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), ) as _i3.Future<_i6.Uint8List>); @override _i3.Future<_i2.StreamedResponse> send(_i2.BaseRequest? request) => (super.noSuchMethod( - Invocation.method(#send, [request]), - returnValue: _i3.Future<_i2.StreamedResponse>.value( - _FakeStreamedResponse_1( - this, - Invocation.method(#send, [request]), - ), + Invocation.method( + #send, + [request], ), + returnValue: _i3.Future<_i2.StreamedResponse>.value(_FakeStreamedResponse_1( + this, + Invocation.method( + #send, + [request], + ), + )), ) as _i3.Future<_i2.StreamedResponse>); @override void close() => super.noSuchMethod( - Invocation.method(#close, []), + Invocation.method( + #close, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/weight/weight_screen_test.mocks.dart b/test/weight/weight_screen_test.mocks.dart index 4edb80d2..0e16dd26 100644 --- a/test/weight/weight_screen_test.mocks.dart +++ b/test/weight/weight_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/weight/weight_screen_test.dart. // Do not manually edit this file. @@ -37,39 +37,83 @@ import 'package:wger/providers/user.dart' as _i13; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightEntry_1 extends _i1.SmartFake implements _i3.WeightEntry { - _FakeWeightEntry_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightEntry_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSharedPreferencesAsync_2 extends _i1.SmartFake implements _i4.SharedPreferencesAsync { - _FakeSharedPreferencesAsync_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeSharedPreferencesAsync_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredientDatabase_3 extends _i1.SmartFake implements _i5.IngredientDatabase { - _FakeIngredientDatabase_3(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeIngredientDatabase_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeNutritionalPlan_4 extends _i1.SmartFake implements _i6.NutritionalPlan { - _FakeNutritionalPlan_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeNutritionalPlan_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMeal_5 extends _i1.SmartFake implements _i7.Meal { - _FakeMeal_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMeal_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMealItem_6 extends _i1.SmartFake implements _i8.MealItem { - _FakeMealItem_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMealItem_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeIngredient_7 extends _i1.SmartFake implements _i9.Ingredient { - _FakeIngredient_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeIngredient_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [BodyWeightProvider]. @@ -97,84 +141,126 @@ class MockBodyWeightProvider extends _i1.Mock implements _i10.BodyWeightProvider @override set items(List<_i3.WeightEntry>? entries) => super.noSuchMethod( - Invocation.setter(#items, entries), + Invocation.setter( + #items, + entries, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightEntry findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeWeightEntry_1( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i3.WeightEntry); @override - _i3.WeightEntry? findByDate(DateTime? date) => - (super.noSuchMethod(Invocation.method(#findByDate, [date])) as _i3.WeightEntry?); + _i3.WeightEntry? findByDate(DateTime? date) => (super.noSuchMethod(Invocation.method( + #findByDate, + [date], + )) as _i3.WeightEntry?); @override _i11.Future> fetchAndSetEntries() => (super.noSuchMethod( - Invocation.method(#fetchAndSetEntries, []), - returnValue: _i11.Future>.value( - <_i3.WeightEntry>[], + Invocation.method( + #fetchAndSetEntries, + [], ), + returnValue: _i11.Future>.value(<_i3.WeightEntry>[]), ) as _i11.Future>); @override _i11.Future<_i3.WeightEntry> addEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( - Invocation.method(#addEntry, [entry]), - returnValue: _i11.Future<_i3.WeightEntry>.value( - _FakeWeightEntry_1(this, Invocation.method(#addEntry, [entry])), + Invocation.method( + #addEntry, + [entry], ), + returnValue: _i11.Future<_i3.WeightEntry>.value(_FakeWeightEntry_1( + this, + Invocation.method( + #addEntry, + [entry], + ), + )), ) as _i11.Future<_i3.WeightEntry>); @override _i11.Future editEntry(_i3.WeightEntry? entry) => (super.noSuchMethod( - Invocation.method(#editEntry, [entry]), + Invocation.method( + #editEntry, + [entry], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future deleteEntry(int? id) => (super.noSuchMethod( - Invocation.method(#deleteEntry, [id]), + Invocation.method( + #deleteEntry, + [id], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -193,12 +279,6 @@ class MockUserProvider extends _i1.Mock implements _i13.UserProvider { returnValue: _i14.ThemeMode.system, ) as _i14.ThemeMode); - @override - set themeMode(_i14.ThemeMode? _themeMode) => super.noSuchMethod( - Invocation.setter(#themeMode, _themeMode), - returnValueForMissingStub: null, - ); - @override _i2.WgerBaseProvider get baseProvider => (super.noSuchMethod( Invocation.getter(#baseProvider), @@ -217,76 +297,120 @@ class MockUserProvider extends _i1.Mock implements _i13.UserProvider { ), ) as _i4.SharedPreferencesAsync); + @override + set themeMode(_i14.ThemeMode? _themeMode) => super.noSuchMethod( + Invocation.setter( + #themeMode, + _themeMode, + ), + returnValueForMissingStub: null, + ); + @override set prefs(_i4.SharedPreferencesAsync? _prefs) => super.noSuchMethod( - Invocation.setter(#prefs, _prefs), + Invocation.setter( + #prefs, + _prefs, + ), returnValueForMissingStub: null, ); @override set profile(_i15.Profile? _profile) => super.noSuchMethod( - Invocation.setter(#profile, _profile), + Invocation.setter( + #profile, + _profile, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override void setThemeMode(_i14.ThemeMode? mode) => super.noSuchMethod( - Invocation.method(#setThemeMode, [mode]), + Invocation.method( + #setThemeMode, + [mode], + ), returnValueForMissingStub: null, ); @override _i11.Future fetchAndSetProfile() => (super.noSuchMethod( - Invocation.method(#fetchAndSetProfile, []), + Invocation.method( + #fetchAndSetProfile, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future saveProfile() => (super.noSuchMethod( - Invocation.method(#saveProfile, []), + Invocation.method( + #saveProfile, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future verifyEmail() => (super.noSuchMethod( - Invocation.method(#verifyEmail, []), + Invocation.method( + #verifyEmail, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } @@ -317,24 +441,12 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans ), ) as _i5.IngredientDatabase); - @override - set database(_i5.IngredientDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i9.Ingredient> get ingredients => (super.noSuchMethod( Invocation.getter(#ingredients), returnValue: <_i9.Ingredient>[], ) as List<_i9.Ingredient>); - @override - set ingredients(List<_i9.Ingredient>? _ingredients) => super.noSuchMethod( - Invocation.setter(#ingredients, _ingredients), - returnValueForMissingStub: null, - ); - @override List<_i6.NutritionalPlan> get items => (super.noSuchMethod( Invocation.getter(#items), @@ -342,108 +454,190 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans ) as List<_i6.NutritionalPlan>); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set database(_i5.IngredientDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), + returnValueForMissingStub: null, + ); + + @override + set ingredients(List<_i9.Ingredient>? _ingredients) => super.noSuchMethod( + Invocation.setter( + #ingredients, + _ingredients, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i6.NutritionalPlan findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeNutritionalPlan_4( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i6.NutritionalPlan); @override - _i7.Meal? findMealById(int? id) => - (super.noSuchMethod(Invocation.method(#findMealById, [id])) as _i7.Meal?); + _i7.Meal? findMealById(int? id) => (super.noSuchMethod(Invocation.method( + #findMealById, + [id], + )) as _i7.Meal?); @override _i11.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetAllPlansFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansFull, []), + Invocation.method( + #fetchAndSetAllPlansFull, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future<_i6.NutritionalPlan> fetchAndSetPlanSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanSparse, [planId]), - returnValue: _i11.Future<_i6.NutritionalPlan>.value( - _FakeNutritionalPlan_4( - this, - Invocation.method(#fetchAndSetPlanSparse, [planId]), - ), + Invocation.method( + #fetchAndSetPlanSparse, + [planId], ), + returnValue: _i11.Future<_i6.NutritionalPlan>.value(_FakeNutritionalPlan_4( + this, + Invocation.method( + #fetchAndSetPlanSparse, + [planId], + ), + )), ) as _i11.Future<_i6.NutritionalPlan>); @override _i11.Future<_i6.NutritionalPlan> fetchAndSetPlanFull(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetPlanFull, [planId]), - returnValue: _i11.Future<_i6.NutritionalPlan>.value( - _FakeNutritionalPlan_4( - this, - Invocation.method(#fetchAndSetPlanFull, [planId]), - ), + Invocation.method( + #fetchAndSetPlanFull, + [planId], ), + returnValue: _i11.Future<_i6.NutritionalPlan>.value(_FakeNutritionalPlan_4( + this, + Invocation.method( + #fetchAndSetPlanFull, + [planId], + ), + )), ) as _i11.Future<_i6.NutritionalPlan>); @override _i11.Future<_i6.NutritionalPlan> addPlan(_i6.NutritionalPlan? planData) => (super.noSuchMethod( - Invocation.method(#addPlan, [planData]), - returnValue: _i11.Future<_i6.NutritionalPlan>.value( - _FakeNutritionalPlan_4( - this, - Invocation.method(#addPlan, [planData]), - ), + Invocation.method( + #addPlan, + [planData], ), + returnValue: _i11.Future<_i6.NutritionalPlan>.value(_FakeNutritionalPlan_4( + this, + Invocation.method( + #addPlan, + [planData], + ), + )), ) as _i11.Future<_i6.NutritionalPlan>); @override _i11.Future editPlan(_i6.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#editPlan, [plan]), + Invocation.method( + #editPlan, + [plan], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future deletePlan(int? id) => (super.noSuchMethod( - Invocation.method(#deletePlan, [id]), + Invocation.method( + #deletePlan, + [id], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i11.Future<_i7.Meal> addMeal(_i7.Meal? meal, int? planId) => (super.noSuchMethod( - Invocation.method(#addMeal, [meal, planId]), - returnValue: _i11.Future<_i7.Meal>.value( - _FakeMeal_5(this, Invocation.method(#addMeal, [meal, planId])), + _i11.Future<_i7.Meal> addMeal( + _i7.Meal? meal, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #addMeal, + [ + meal, + planId, + ], ), + returnValue: _i11.Future<_i7.Meal>.value(_FakeMeal_5( + this, + Invocation.method( + #addMeal, + [ + meal, + planId, + ], + ), + )), ) as _i11.Future<_i7.Meal>); @override _i11.Future<_i7.Meal> editMeal(_i7.Meal? meal) => (super.noSuchMethod( - Invocation.method(#editMeal, [meal]), - returnValue: _i11.Future<_i7.Meal>.value( - _FakeMeal_5(this, Invocation.method(#editMeal, [meal])), + Invocation.method( + #editMeal, + [meal], ), + returnValue: _i11.Future<_i7.Meal>.value(_FakeMeal_5( + this, + Invocation.method( + #editMeal, + [meal], + ), + )), ) as _i11.Future<_i7.Meal>); @override _i11.Future deleteMeal(_i7.Meal? meal) => (super.noSuchMethod( - Invocation.method(#deleteMeal, [meal]), + Invocation.method( + #deleteMeal, + [meal], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -454,25 +648,41 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans _i7.Meal? meal, ) => (super.noSuchMethod( - Invocation.method(#addMealItem, [mealItem, meal]), - returnValue: _i11.Future<_i8.MealItem>.value( - _FakeMealItem_6( - this, - Invocation.method(#addMealItem, [mealItem, meal]), - ), + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], ), + returnValue: _i11.Future<_i8.MealItem>.value(_FakeMealItem_6( + this, + Invocation.method( + #addMealItem, + [ + mealItem, + meal, + ], + ), + )), ) as _i11.Future<_i8.MealItem>); @override _i11.Future deleteMealItem(_i8.MealItem? mealItem) => (super.noSuchMethod( - Invocation.method(#deleteMealItem, [mealItem]), + Invocation.method( + #deleteMealItem, + [mealItem], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future clearIngredientCache() => (super.noSuchMethod( - Invocation.method(#clearIngredientCache, []), + Invocation.method( + #clearIngredientCache, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -488,21 +698,22 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans [ingredientId], {#database: database}, ), - returnValue: _i11.Future<_i9.Ingredient>.value( - _FakeIngredient_7( - this, - Invocation.method( - #fetchIngredient, - [ingredientId], - {#database: database}, - ), + returnValue: _i11.Future<_i9.Ingredient>.value(_FakeIngredient_7( + this, + Invocation.method( + #fetchIngredient, + [ingredientId], + {#database: database}, ), - ), + )), ) as _i11.Future<_i9.Ingredient>); @override _i11.Future fetchIngredientsFromCache() => (super.noSuchMethod( - Invocation.method(#fetchIngredientsFromCache, []), + Invocation.method( + #fetchIngredientsFromCache, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -517,22 +728,30 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans Invocation.method( #searchIngredient, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), returnValue: _i11.Future>.value( - <_i17.IngredientApiSearchEntry>[], - ), + <_i17.IngredientApiSearchEntry>[]), ) as _i11.Future>); @override _i11.Future<_i9.Ingredient?> searchIngredientWithCode(String? code) => (super.noSuchMethod( - Invocation.method(#searchIngredientWithCode, [code]), + Invocation.method( + #searchIngredientWithCode, + [code], + ), returnValue: _i11.Future<_i9.Ingredient?>.value(), ) as _i11.Future<_i9.Ingredient?>); @override _i11.Future logMealToDiary(_i7.Meal? meal) => (super.noSuchMethod( - Invocation.method(#logMealToDiary, [meal]), + Invocation.method( + #logMealToDiary, + [meal], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -544,50 +763,78 @@ class MockNutritionPlansProvider extends _i1.Mock implements _i16.NutritionPlans DateTime? dateTime, ]) => (super.noSuchMethod( - Invocation.method(#logIngredientToDiary, [ - mealItem, - planId, - dateTime, - ]), + Invocation.method( + #logIngredientToDiary, + [ + mealItem, + planId, + dateTime, + ], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - _i11.Future deleteLog(int? logId, int? planId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, planId]), + _i11.Future deleteLog( + int? logId, + int? planId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + planId, + ], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetLogs(_i6.NutritionalPlan? plan) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLogs, [plan]), + Invocation.method( + #fetchAndSetLogs, + [plan], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/day_form_test.mocks.dart b/test/workout/day_form_test.mocks.dart index ccd1bd6f..c8a20ef3 100644 --- a/test/workout/day_form_test.mocks.dart +++ b/test/workout/day_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/day_form_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/gym_mode_screen_test.mocks.dart b/test/workout/gym_mode_screen_test.mocks.dart index ce4da1a9..8e6d257b 100644 --- a/test/workout/gym_mode_screen_test.mocks.dart +++ b/test/workout/gym_mode_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/gym_mode_screen_test.dart. // Do not manually edit this file. @@ -33,50 +33,113 @@ import 'package:wger/providers/exercises.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { - _FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { - _FakeExerciseDatabase_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseDatabase_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { - _FakeExercise_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { - _FakeExerciseCategory_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseCategory_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { - _FakeEquipment_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { - _FakeMuscle_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { - _FakeLanguage_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WgerBaseProvider]. @@ -90,32 +153,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); + @override + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -130,27 +207,41 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i11.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i11.Future.value(), ) as _i11.Future); @override _i11.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i11.Future>.value([]), ) as _i11.Future>); @@ -160,10 +251,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i11.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i11.Future>.value({}), ) as _i11.Future>); @override @@ -172,21 +267,39 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i11.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i11.Future>.value({}), ) as _i11.Future>); @override - _i11.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i11.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i11.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i11.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i11.Future<_i3.Response>); } @@ -216,36 +329,18 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { ), ) as _i5.ExerciseDatabase); - @override - set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i6.Exercise> get exercises => (super.noSuchMethod( Invocation.getter(#exercises), returnValue: <_i6.Exercise>[], ) as List<_i6.Exercise>); - @override - set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( - Invocation.setter(#exercises, _exercises), - returnValueForMissingStub: null, - ); - @override List<_i6.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), returnValue: <_i6.Exercise>[], ) as List<_i6.Exercise>); - @override - set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); - @override Map> get exerciseByVariation => (super.noSuchMethod( Invocation.getter(#exerciseByVariation), @@ -277,47 +372,97 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { ) as List<_i10.Language>); @override - set languages(List<_i10.Language>? languages) => super.noSuchMethod( - Invocation.setter(#languages, languages), + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter( + #exercises, + _exercises, + ), + returnValueForMissingStub: null, + ); + + @override + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( + Invocation.setter( + #filteredExercises, + newFilteredExercises, + ), + returnValueForMissingStub: null, + ); + + @override + set languages(List<_i10.Language>? languages) => super.noSuchMethod( + Invocation.setter( + #languages, + languages, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i11.Future setFilters(_i12.Filters? newFilters) => (super.noSuchMethod( - Invocation.method(#setFilters, [newFilters]), + Invocation.method( + #setFilters, + [newFilters], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void initFilters() => super.noSuchMethod( - Invocation.method(#initFilters, []), + Invocation.method( + #initFilters, + [], + ), returnValueForMissingStub: null, ); @override _i11.Future findByFilters() => (super.noSuchMethod( - Invocation.method(#findByFilters, []), + Invocation.method( + #findByFilters, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i6.Exercise findExerciseById(int? id) => (super.noSuchMethod( - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), returnValue: _FakeExercise_6( this, - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), ), ) as _i6.Exercise); @@ -337,71 +482,110 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { @override _i7.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), returnValue: _FakeExerciseCategory_7( this, - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), ), ) as _i7.ExerciseCategory); @override _i8.Equipment findEquipmentById(int? id) => (super.noSuchMethod( - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), returnValue: _FakeEquipment_8( this, - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), ), ) as _i8.Equipment); @override _i9.Muscle findMuscleById(int? id) => (super.noSuchMethod( - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), returnValue: _FakeMuscle_9( this, - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), ), ) as _i9.Muscle); @override _i10.Language findLanguageById(int? id) => (super.noSuchMethod( - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), returnValue: _FakeLanguage_10( this, - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), ), ) as _i10.Language); @override _i11.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategoriesFromApi, []), + Invocation.method( + #fetchAndSetCategoriesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetMusclesFromApi, []), + Invocation.method( + #fetchAndSetMusclesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipmentsFromApi, []), + Invocation.method( + #fetchAndSetEquipmentsFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguagesFromApi, []), + Invocation.method( + #fetchAndSetLanguagesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future<_i6.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetExercise, [exerciseId]), + Invocation.method( + #fetchAndSetExercise, + [exerciseId], + ), returnValue: _i11.Future<_i6.Exercise?>.value(), ) as _i11.Future<_i6.Exercise?>); @@ -411,40 +595,52 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { int? exerciseId, ) => (super.noSuchMethod( - Invocation.method(#handleUpdateExerciseFromApi, [ - database, - exerciseId, - ]), - returnValue: _i11.Future<_i6.Exercise>.value( - _FakeExercise_6( - this, - Invocation.method(#handleUpdateExerciseFromApi, [ + Invocation.method( + #handleUpdateExerciseFromApi, + [ + database, + exerciseId, + ], + ), + returnValue: _i11.Future<_i6.Exercise>.value(_FakeExercise_6( + this, + Invocation.method( + #handleUpdateExerciseFromApi, + [ database, exerciseId, - ]), + ], ), - ), + )), ) as _i11.Future<_i6.Exercise>); @override _i11.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( - Invocation.method(#initCacheTimesLocalPrefs, [], { - #forceInit: forceInit, - }), + Invocation.method( + #initCacheTimesLocalPrefs, + [], + {#forceInit: forceInit}, + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future clearAllCachesAndPrefs() => (super.noSuchMethod( - Invocation.method(#clearAllCachesAndPrefs, []), + Invocation.method( + #clearAllCachesAndPrefs, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetInitialData() => (super.noSuchMethod( - Invocation.method(#fetchAndSetInitialData, []), + Invocation.method( + #fetchAndSetInitialData, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -466,35 +662,50 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { @override _i11.Future updateExerciseCache(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#updateExerciseCache, [database]), + Invocation.method( + #updateExerciseCache, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetMuscles(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetMuscles, [database]), + Invocation.method( + #fetchAndSetMuscles, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetCategories(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategories, [database]), + Invocation.method( + #fetchAndSetCategories, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetLanguages(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguages, [database]), + Invocation.method( + #fetchAndSetLanguages, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetEquipments(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipments, [database]), + Invocation.method( + #fetchAndSetEquipments, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -509,34 +720,47 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { Invocation.method( #searchExercise, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, - ), - returnValue: _i11.Future>.value( - <_i6.Exercise>[], + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), + returnValue: _i11.Future>.value(<_i6.Exercise>[]), ) as _i11.Future>); @override void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/gym_mode_session_screen_test.dart b/test/workout/gym_mode_session_screen_test.dart index 3b36bee2..a865b154 100644 --- a/test/workout/gym_mode_session_screen_test.dart +++ b/test/workout/gym_mode_session_screen_test.dart @@ -38,6 +38,10 @@ void main() { setUp(() { testRoutine = getTestRoutine(); + + when(mockRoutinesProvider.editSession(any)).thenAnswer( + (_) => Future.value(testRoutine.sessions[0].session), + ); }); Widget renderSessionPage({locale = 'en'}) { diff --git a/test/workout/gym_mode_session_screen_test.mocks.dart b/test/workout/gym_mode_session_screen_test.mocks.dart index 3297573a..e63ffb2e 100644 --- a/test/workout/gym_mode_session_screen_test.mocks.dart +++ b/test/workout/gym_mode_session_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/gym_mode_session_screen_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/repetition_unit_form_widget_test.mocks.dart b/test/workout/repetition_unit_form_widget_test.mocks.dart index 7764f336..da5982b6 100644 --- a/test/workout/repetition_unit_form_widget_test.mocks.dart +++ b/test/workout/repetition_unit_form_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/repetition_unit_form_widget_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routine_edit_screen_test.mocks.dart b/test/workout/routine_edit_screen_test.mocks.dart index 8fbd8e1e..3b326f26 100644 --- a/test/workout/routine_edit_screen_test.mocks.dart +++ b/test/workout/routine_edit_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routine_edit_screen_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routine_edit_test.mocks.dart b/test/workout/routine_edit_test.mocks.dart index e0874cb3..e92d7d1f 100644 --- a/test/workout/routine_edit_test.mocks.dart +++ b/test/workout/routine_edit_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routine_edit_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routine_form_test.mocks.dart b/test/workout/routine_form_test.mocks.dart index af723622..38354316 100644 --- a/test/workout/routine_form_test.mocks.dart +++ b/test/workout/routine_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routine_form_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routine_logs_screen_test.mocks.dart b/test/workout/routine_logs_screen_test.mocks.dart index c5b9828f..ce4460a2 100644 --- a/test/workout/routine_logs_screen_test.mocks.dart +++ b/test/workout/routine_logs_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routine_logs_screen_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routine_screen_test.mocks.dart b/test/workout/routine_screen_test.mocks.dart index 4edf9409..2082ea11 100644 --- a/test/workout/routine_screen_test.mocks.dart +++ b/test/workout/routine_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routine_screen_test.dart. // Do not manually edit this file. @@ -25,19 +25,43 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WgerBaseProvider]. @@ -51,32 +75,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); + @override + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -91,37 +129,58 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i5.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); @override - _i5.Future> post(Map? data, Uri? uri) => + _i5.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override @@ -130,20 +189,38 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override - _i5.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i5.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i5.Future<_i3.Response>); } diff --git a/test/workout/routines_provider_test.mocks.dart b/test/workout/routines_provider_test.mocks.dart index 35a1cc8d..30dc882b 100644 --- a/test/workout/routines_provider_test.mocks.dart +++ b/test/workout/routines_provider_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routines_provider_test.dart. // Do not manually edit this file. @@ -33,50 +33,113 @@ import 'package:wger/providers/exercises.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWgerBaseProvider_4 extends _i1.SmartFake implements _i4.WgerBaseProvider { - _FakeWgerBaseProvider_4(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseDatabase_5 extends _i1.SmartFake implements _i5.ExerciseDatabase { - _FakeExerciseDatabase_5(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseDatabase_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExercise_6 extends _i1.SmartFake implements _i6.Exercise { - _FakeExercise_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeExercise_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeExerciseCategory_7 extends _i1.SmartFake implements _i7.ExerciseCategory { - _FakeExerciseCategory_7(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeExerciseCategory_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeEquipment_8 extends _i1.SmartFake implements _i8.Equipment { - _FakeEquipment_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeEquipment_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeMuscle_9 extends _i1.SmartFake implements _i9.Muscle { - _FakeMuscle_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeMuscle_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLanguage_10 extends _i1.SmartFake implements _i10.Language { - _FakeLanguage_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLanguage_10( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WgerBaseProvider]. @@ -90,32 +153,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); + @override + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -130,27 +207,41 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i11.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i11.Future.value(), ) as _i11.Future); @override _i11.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i11.Future>.value([]), ) as _i11.Future>); @@ -160,10 +251,14 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i11.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i11.Future>.value({}), ) as _i11.Future>); @override @@ -172,21 +267,39 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i11.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i11.Future>.value({}), ) as _i11.Future>); @override - _i11.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i11.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i11.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i11.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i11.Future<_i3.Response>); } @@ -216,36 +329,18 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { ), ) as _i5.ExerciseDatabase); - @override - set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( - Invocation.setter(#database, _database), - returnValueForMissingStub: null, - ); - @override List<_i6.Exercise> get exercises => (super.noSuchMethod( Invocation.getter(#exercises), returnValue: <_i6.Exercise>[], ) as List<_i6.Exercise>); - @override - set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( - Invocation.setter(#exercises, _exercises), - returnValueForMissingStub: null, - ); - @override List<_i6.Exercise> get filteredExercises => (super.noSuchMethod( Invocation.getter(#filteredExercises), returnValue: <_i6.Exercise>[], ) as List<_i6.Exercise>); - @override - set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( - Invocation.setter(#filteredExercises, newFilteredExercises), - returnValueForMissingStub: null, - ); - @override Map> get exerciseByVariation => (super.noSuchMethod( Invocation.getter(#exerciseByVariation), @@ -277,47 +372,97 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { ) as List<_i10.Language>); @override - set languages(List<_i10.Language>? languages) => super.noSuchMethod( - Invocation.setter(#languages, languages), + set database(_i5.ExerciseDatabase? _database) => super.noSuchMethod( + Invocation.setter( + #database, + _database, + ), returnValueForMissingStub: null, ); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set exercises(List<_i6.Exercise>? _exercises) => super.noSuchMethod( + Invocation.setter( + #exercises, + _exercises, + ), + returnValueForMissingStub: null, + ); + + @override + set filteredExercises(List<_i6.Exercise>? newFilteredExercises) => super.noSuchMethod( + Invocation.setter( + #filteredExercises, + newFilteredExercises, + ), + returnValueForMissingStub: null, + ); + + @override + set languages(List<_i10.Language>? languages) => super.noSuchMethod( + Invocation.setter( + #languages, + languages, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override _i11.Future setFilters(_i12.Filters? newFilters) => (super.noSuchMethod( - Invocation.method(#setFilters, [newFilters]), + Invocation.method( + #setFilters, + [newFilters], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void initFilters() => super.noSuchMethod( - Invocation.method(#initFilters, []), + Invocation.method( + #initFilters, + [], + ), returnValueForMissingStub: null, ); @override _i11.Future findByFilters() => (super.noSuchMethod( - Invocation.method(#findByFilters, []), + Invocation.method( + #findByFilters, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i6.Exercise findExerciseById(int? id) => (super.noSuchMethod( - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), returnValue: _FakeExercise_6( this, - Invocation.method(#findExerciseById, [id]), + Invocation.method( + #findExerciseById, + [id], + ), ), ) as _i6.Exercise); @@ -337,71 +482,110 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { @override _i7.ExerciseCategory findCategoryById(int? id) => (super.noSuchMethod( - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), returnValue: _FakeExerciseCategory_7( this, - Invocation.method(#findCategoryById, [id]), + Invocation.method( + #findCategoryById, + [id], + ), ), ) as _i7.ExerciseCategory); @override _i8.Equipment findEquipmentById(int? id) => (super.noSuchMethod( - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), returnValue: _FakeEquipment_8( this, - Invocation.method(#findEquipmentById, [id]), + Invocation.method( + #findEquipmentById, + [id], + ), ), ) as _i8.Equipment); @override _i9.Muscle findMuscleById(int? id) => (super.noSuchMethod( - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), returnValue: _FakeMuscle_9( this, - Invocation.method(#findMuscleById, [id]), + Invocation.method( + #findMuscleById, + [id], + ), ), ) as _i9.Muscle); @override _i10.Language findLanguageById(int? id) => (super.noSuchMethod( - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), returnValue: _FakeLanguage_10( this, - Invocation.method(#findLanguageById, [id]), + Invocation.method( + #findLanguageById, + [id], + ), ), ) as _i10.Language); @override _i11.Future fetchAndSetCategoriesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategoriesFromApi, []), + Invocation.method( + #fetchAndSetCategoriesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetMusclesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetMusclesFromApi, []), + Invocation.method( + #fetchAndSetMusclesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetEquipmentsFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipmentsFromApi, []), + Invocation.method( + #fetchAndSetEquipmentsFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetLanguagesFromApi() => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguagesFromApi, []), + Invocation.method( + #fetchAndSetLanguagesFromApi, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future<_i6.Exercise?> fetchAndSetExercise(int? exerciseId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetExercise, [exerciseId]), + Invocation.method( + #fetchAndSetExercise, + [exerciseId], + ), returnValue: _i11.Future<_i6.Exercise?>.value(), ) as _i11.Future<_i6.Exercise?>); @@ -411,40 +595,52 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { int? exerciseId, ) => (super.noSuchMethod( - Invocation.method(#handleUpdateExerciseFromApi, [ - database, - exerciseId, - ]), - returnValue: _i11.Future<_i6.Exercise>.value( - _FakeExercise_6( - this, - Invocation.method(#handleUpdateExerciseFromApi, [ + Invocation.method( + #handleUpdateExerciseFromApi, + [ + database, + exerciseId, + ], + ), + returnValue: _i11.Future<_i6.Exercise>.value(_FakeExercise_6( + this, + Invocation.method( + #handleUpdateExerciseFromApi, + [ database, exerciseId, - ]), + ], ), - ), + )), ) as _i11.Future<_i6.Exercise>); @override _i11.Future initCacheTimesLocalPrefs({dynamic forceInit = false}) => (super.noSuchMethod( - Invocation.method(#initCacheTimesLocalPrefs, [], { - #forceInit: forceInit, - }), + Invocation.method( + #initCacheTimesLocalPrefs, + [], + {#forceInit: forceInit}, + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future clearAllCachesAndPrefs() => (super.noSuchMethod( - Invocation.method(#clearAllCachesAndPrefs, []), + Invocation.method( + #clearAllCachesAndPrefs, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetInitialData() => (super.noSuchMethod( - Invocation.method(#fetchAndSetInitialData, []), + Invocation.method( + #fetchAndSetInitialData, + [], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -466,35 +662,50 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { @override _i11.Future updateExerciseCache(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#updateExerciseCache, [database]), + Invocation.method( + #updateExerciseCache, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetMuscles(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetMuscles, [database]), + Invocation.method( + #fetchAndSetMuscles, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetCategories(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetCategories, [database]), + Invocation.method( + #fetchAndSetCategories, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetLanguages(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetLanguages, [database]), + Invocation.method( + #fetchAndSetLanguages, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override _i11.Future fetchAndSetEquipments(_i5.ExerciseDatabase? database) => (super.noSuchMethod( - Invocation.method(#fetchAndSetEquipments, [database]), + Invocation.method( + #fetchAndSetEquipments, + [database], + ), returnValue: _i11.Future.value(), returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @@ -509,34 +720,47 @@ class MockExercisesProvider extends _i1.Mock implements _i12.ExercisesProvider { Invocation.method( #searchExercise, [name], - {#languageCode: languageCode, #searchEnglish: searchEnglish}, - ), - returnValue: _i11.Future>.value( - <_i6.Exercise>[], + { + #languageCode: languageCode, + #searchEnglish: searchEnglish, + }, ), + returnValue: _i11.Future>.value(<_i6.Exercise>[]), ) as _i11.Future>); @override void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/routines_screen_test.mocks.dart b/test/workout/routines_screen_test.mocks.dart index da873d63..0678fcc6 100644 --- a/test/workout/routines_screen_test.mocks.dart +++ b/test/workout/routines_screen_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/routines_screen_test.dart. // Do not manually edit this file. @@ -25,19 +25,43 @@ import 'package:wger/providers/base_provider.dart' as _i4; // ignore_for_file: subtype_of_sealed_class class _FakeAuthProvider_0 extends _i1.SmartFake implements _i2.AuthProvider { - _FakeAuthProvider_0(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeAuthProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeClient_1 extends _i1.SmartFake implements _i3.Client { - _FakeClient_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeClient_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeUri_2 extends _i1.SmartFake implements Uri { - _FakeUri_2(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeUri_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeResponse_3 extends _i1.SmartFake implements _i3.Response { - _FakeResponse_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeResponse_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [WgerBaseProvider]. @@ -51,32 +75,46 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { @override _i2.AuthProvider get auth => (super.noSuchMethod( Invocation.getter(#auth), - returnValue: _FakeAuthProvider_0(this, Invocation.getter(#auth)), + returnValue: _FakeAuthProvider_0( + this, + Invocation.getter(#auth), + ), ) as _i2.AuthProvider); - @override - set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( - Invocation.setter(#auth, _auth), - returnValueForMissingStub: null, - ); - @override _i3.Client get client => (super.noSuchMethod( Invocation.getter(#client), - returnValue: _FakeClient_1(this, Invocation.getter(#client)), + returnValue: _FakeClient_1( + this, + Invocation.getter(#client), + ), ) as _i3.Client); + @override + set auth(_i2.AuthProvider? _auth) => super.noSuchMethod( + Invocation.setter( + #auth, + _auth, + ), + returnValueForMissingStub: null, + ); + @override set client(_i3.Client? _client) => super.noSuchMethod( - Invocation.setter(#client, _client), + Invocation.setter( + #client, + _client, + ), returnValueForMissingStub: null, ); @override Map getDefaultHeaders({bool? includeAuth = false}) => (super.noSuchMethod( - Invocation.method(#getDefaultHeaders, [], { - #includeAuth: includeAuth, - }), + Invocation.method( + #getDefaultHeaders, + [], + {#includeAuth: includeAuth}, + ), returnValue: {}, ) as Map); @@ -91,37 +129,58 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), returnValue: _FakeUri_2( this, Invocation.method( #makeUrl, [path], - {#id: id, #objectMethod: objectMethod, #query: query}, + { + #id: id, + #objectMethod: objectMethod, + #query: query, + }, ), ), ) as Uri); @override _i5.Future fetch(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetch, [uri]), + Invocation.method( + #fetch, + [uri], + ), returnValue: _i5.Future.value(), ) as _i5.Future); @override _i5.Future> fetchPaginated(Uri? uri) => (super.noSuchMethod( - Invocation.method(#fetchPaginated, [uri]), + Invocation.method( + #fetchPaginated, + [uri], + ), returnValue: _i5.Future>.value([]), ) as _i5.Future>); @override - _i5.Future> post(Map? data, Uri? uri) => + _i5.Future> post( + Map? data, + Uri? uri, + ) => (super.noSuchMethod( - Invocation.method(#post, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #post, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override @@ -130,20 +189,38 @@ class MockWgerBaseProvider extends _i1.Mock implements _i4.WgerBaseProvider { Uri? uri, ) => (super.noSuchMethod( - Invocation.method(#patch, [data, uri]), - returnValue: _i5.Future>.value( - {}, + Invocation.method( + #patch, + [ + data, + uri, + ], ), + returnValue: _i5.Future>.value({}), ) as _i5.Future>); @override - _i5.Future<_i3.Response> deleteRequest(String? url, int? id) => (super.noSuchMethod( - Invocation.method(#deleteRequest, [url, id]), - returnValue: _i5.Future<_i3.Response>.value( - _FakeResponse_3( - this, - Invocation.method(#deleteRequest, [url, id]), - ), + _i5.Future<_i3.Response> deleteRequest( + String? url, + int? id, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteRequest, + [ + url, + id, + ], ), + returnValue: _i5.Future<_i3.Response>.value(_FakeResponse_3( + this, + Invocation.method( + #deleteRequest, + [ + url, + id, + ], + ), + )), ) as _i5.Future<_i3.Response>); } diff --git a/test/workout/slot_entry_form_test.mocks.dart b/test/workout/slot_entry_form_test.mocks.dart index 3eb6ed3b..22b0fe23 100644 --- a/test/workout/slot_entry_form_test.mocks.dart +++ b/test/workout/slot_entry_form_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/slot_entry_form_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } diff --git a/test/workout/weight_unit_form_widget_test.mocks.dart b/test/workout/weight_unit_form_widget_test.mocks.dart index b84bfb49..bf52b7f6 100644 --- a/test/workout/weight_unit_form_widget_test.mocks.dart +++ b/test/workout/weight_unit_form_widget_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.5 from annotations +// Mocks generated by Mockito 5.4.6 from annotations // in wger/test/workout/weight_unit_form_widget_test.dart. // Do not manually edit this file. @@ -36,46 +36,103 @@ import 'package:wger/providers/routines.dart' as _i12; // ignore_for_file: subtype_of_sealed_class class _FakeWgerBaseProvider_0 extends _i1.SmartFake implements _i2.WgerBaseProvider { - _FakeWgerBaseProvider_0(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWgerBaseProvider_0( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWeightUnit_1 extends _i1.SmartFake implements _i3.WeightUnit { - _FakeWeightUnit_1(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeWeightUnit_1( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRepetitionUnit_2 extends _i1.SmartFake implements _i4.RepetitionUnit { - _FakeRepetitionUnit_2(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeRepetitionUnit_2( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeRoutine_3 extends _i1.SmartFake implements _i5.Routine { - _FakeRoutine_3(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeRoutine_3( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeDay_4 extends _i1.SmartFake implements _i6.Day { - _FakeDay_4(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeDay_4( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlot_5 extends _i1.SmartFake implements _i7.Slot { - _FakeSlot_5(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlot_5( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeSlotEntry_6 extends _i1.SmartFake implements _i8.SlotEntry { - _FakeSlotEntry_6(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeSlotEntry_6( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeBaseConfig_7 extends _i1.SmartFake implements _i9.BaseConfig { - _FakeBaseConfig_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeBaseConfig_7( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeWorkoutSession_8 extends _i1.SmartFake implements _i10.WorkoutSession { - _FakeWorkoutSession_8(Object parent, Invocation parentInvocation) - : super(parent, parentInvocation); + _FakeWorkoutSession_8( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } class _FakeLog_9 extends _i1.SmartFake implements _i11.Log { - _FakeLog_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); + _FakeLog_9( + Object parent, + Invocation parentInvocation, + ) : super( + parent, + parentInvocation, + ); } /// A class which mocks [RoutinesProvider]. @@ -107,12 +164,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i3.WeightUnit>[], ) as List<_i3.WeightUnit>); - @override - set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( - Invocation.setter(#weightUnits, weightUnits), - returnValueForMissingStub: null, - ); - @override _i3.WeightUnit get defaultWeightUnit => (super.noSuchMethod( Invocation.getter(#defaultWeightUnit), @@ -128,12 +179,6 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { returnValue: <_i4.RepetitionUnit>[], ) as List<_i4.RepetitionUnit>); - @override - set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( - Invocation.setter(#repetitionUnits, repetitionUnits), - returnValueForMissingStub: null, - ); - @override _i4.RepetitionUnit get defaultRepetitionUnit => (super.noSuchMethod( Invocation.getter(#defaultRepetitionUnit), @@ -144,206 +189,361 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i4.RepetitionUnit); @override - bool get hasListeners => - (super.noSuchMethod(Invocation.getter(#hasListeners), returnValue: false) as bool); + set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( + Invocation.setter( + #weightUnits, + weightUnits, + ), + returnValueForMissingStub: null, + ); + + @override + set repetitionUnits(List<_i4.RepetitionUnit>? repetitionUnits) => super.noSuchMethod( + Invocation.setter( + #repetitionUnits, + repetitionUnits, + ), + returnValueForMissingStub: null, + ); + + @override + bool get hasListeners => (super.noSuchMethod( + Invocation.getter(#hasListeners), + returnValue: false, + ) as bool); @override void clear() => super.noSuchMethod( - Invocation.method(#clear, []), + Invocation.method( + #clear, + [], + ), returnValueForMissingStub: null, ); @override _i3.WeightUnit findWeightUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), returnValue: _FakeWeightUnit_1( this, - Invocation.method(#findWeightUnitById, [id]), + Invocation.method( + #findWeightUnitById, + [id], + ), ), ) as _i3.WeightUnit); @override _i4.RepetitionUnit findRepetitionUnitById(int? id) => (super.noSuchMethod( - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), returnValue: _FakeRepetitionUnit_2( this, - Invocation.method(#findRepetitionUnitById, [id]), + Invocation.method( + #findRepetitionUnitById, + [id], + ), ), ) as _i4.RepetitionUnit); @override List<_i5.Routine> getPlans() => (super.noSuchMethod( - Invocation.method(#getPlans, []), + Invocation.method( + #getPlans, + [], + ), returnValue: <_i5.Routine>[], ) as List<_i5.Routine>); @override _i5.Routine findById(int? id) => (super.noSuchMethod( - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), returnValue: _FakeRoutine_3( this, - Invocation.method(#findById, [id]), + Invocation.method( + #findById, + [id], + ), ), ) as _i5.Routine); @override int findIndexById(int? id) => (super.noSuchMethod( - Invocation.method(#findIndexById, [id]), + Invocation.method( + #findIndexById, + [id], + ), returnValue: 0, ) as int); @override void setCurrentPlan(int? id) => super.noSuchMethod( - Invocation.method(#setCurrentPlan, [id]), + Invocation.method( + #setCurrentPlan, + [id], + ), returnValueForMissingStub: null, ); @override void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method(#resetCurrentRoutine, []), + Invocation.method( + #resetCurrentRoutine, + [], + ), returnValueForMissingStub: null, ); @override _i13.Future fetchAndSetAllRoutinesFull() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllRoutinesFull, []), + Invocation.method( + #fetchAndSetAllRoutinesFull, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( - Invocation.method(#fetchAndSetAllPlansSparse, []), + Invocation.method( + #fetchAndSetAllPlansSparse, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future setExercisesAndUnits(List<_i14.DayData>? entries) => (super.noSuchMethod( - Invocation.method(#setExercisesAndUnits, [entries]), + Invocation.method( + #setExercisesAndUnits, + [entries], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i5.Routine> fetchAndSetRoutineSparse(int? planId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineSparse, [planId]), - ), + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineSparse, + [planId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> fetchAndSetRoutineFull(int? routineId) => (super.noSuchMethod( - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3( - this, - Invocation.method(#fetchAndSetRoutineFull, [routineId]), - ), + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #fetchAndSetRoutineFull, + [routineId], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future<_i5.Routine> addRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#addRoutine, [routine]), - returnValue: _i13.Future<_i5.Routine>.value( - _FakeRoutine_3(this, Invocation.method(#addRoutine, [routine])), + Invocation.method( + #addRoutine, + [routine], ), + returnValue: _i13.Future<_i5.Routine>.value(_FakeRoutine_3( + this, + Invocation.method( + #addRoutine, + [routine], + ), + )), ) as _i13.Future<_i5.Routine>); @override _i13.Future editRoutine(_i5.Routine? routine) => (super.noSuchMethod( - Invocation.method(#editRoutine, [routine]), + Invocation.method( + #editRoutine, + [routine], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteRoutine(int? id) => (super.noSuchMethod( - Invocation.method(#deleteRoutine, [id]), + Invocation.method( + #deleteRoutine, + [id], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetRepetitionUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetRepetitionUnits, []), + Invocation.method( + #fetchAndSetRepetitionUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetWeightUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetWeightUnits, []), + Invocation.method( + #fetchAndSetWeightUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future fetchAndSetUnits() => (super.noSuchMethod( - Invocation.method(#fetchAndSetUnits, []), + Invocation.method( + #fetchAndSetUnits, + [], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future<_i6.Day> addDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#addDay, [day]), - returnValue: _i13.Future<_i6.Day>.value( - _FakeDay_4(this, Invocation.method(#addDay, [day])), + Invocation.method( + #addDay, + [day], ), + returnValue: _i13.Future<_i6.Day>.value(_FakeDay_4( + this, + Invocation.method( + #addDay, + [day], + ), + )), ) as _i13.Future<_i6.Day>); @override _i13.Future editDay(_i6.Day? day) => (super.noSuchMethod( - Invocation.method(#editDay, [day]), + Invocation.method( + #editDay, + [day], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future editDays(List<_i6.Day>? days) => (super.noSuchMethod( - Invocation.method(#editDays, [days]), + Invocation.method( + #editDays, + [days], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future deleteDay(int? dayId) => (super.noSuchMethod( - Invocation.method(#deleteDay, [dayId]), + Invocation.method( + #deleteDay, + [dayId], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future<_i7.Slot> addSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#addSlot, [slot, routineId]), - returnValue: _i13.Future<_i7.Slot>.value( - _FakeSlot_5(this, Invocation.method(#addSlot, [slot, routineId])), + _i13.Future<_i7.Slot> addSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], ), + returnValue: _i13.Future<_i7.Slot>.value(_FakeSlot_5( + this, + Invocation.method( + #addSlot, + [ + slot, + routineId, + ], + ), + )), ) as _i13.Future<_i7.Slot>); @override - _i13.Future deleteSlot(int? slotId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlot, [slotId, routineId]), + _i13.Future deleteSlot( + int? slotId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlot, + [ + slotId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlot(_i7.Slot? slot, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlot, [slot, routineId]), + _i13.Future editSlot( + _i7.Slot? slot, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlot, + [ + slot, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlots(List<_i7.Slot>? slots, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlots, [slots, routineId]), + _i13.Future editSlots( + List<_i7.Slot>? slots, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlots, + [ + slots, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -354,35 +554,71 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSlotEntry, [entry, routineId]), - returnValue: _i13.Future<_i8.SlotEntry>.value( - _FakeSlotEntry_6( - this, - Invocation.method(#addSlotEntry, [entry, routineId]), - ), + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], ), + returnValue: _i13.Future<_i8.SlotEntry>.value(_FakeSlotEntry_6( + this, + Invocation.method( + #addSlotEntry, + [ + entry, + routineId, + ], + ), + )), ) as _i13.Future<_i8.SlotEntry>); @override - _i13.Future deleteSlotEntry(int? id, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteSlotEntry, [id, routineId]), + _i13.Future deleteSlotEntry( + int? id, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteSlotEntry, + [ + id, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override - _i13.Future editSlotEntry(_i8.SlotEntry? entry, int? routineId) => (super.noSuchMethod( - Invocation.method(#editSlotEntry, [entry, routineId]), + _i13.Future editSlotEntry( + _i8.SlotEntry? entry, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #editSlotEntry, + [ + entry, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override String getConfigUrl(_i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), returnValue: _i15.dummyValue( this, - Invocation.method(#getConfigUrl, [type]), + Invocation.method( + #getConfigUrl, + [type], + ), ), ) as String); @@ -392,13 +628,23 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#editConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#editConfig, [config, type]), - ), + Invocation.method( + #editConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #editConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override @@ -407,18 +653,38 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#addConfig, [config, type]), - returnValue: _i13.Future<_i9.BaseConfig>.value( - _FakeBaseConfig_7( - this, - Invocation.method(#addConfig, [config, type]), - ), + Invocation.method( + #addConfig, + [ + config, + type, + ], ), + returnValue: _i13.Future<_i9.BaseConfig>.value(_FakeBaseConfig_7( + this, + Invocation.method( + #addConfig, + [ + config, + type, + ], + ), + )), ) as _i13.Future<_i9.BaseConfig>); @override - _i13.Future deleteConfig(int? id, _i8.ConfigType? type) => (super.noSuchMethod( - Invocation.method(#deleteConfig, [id, type]), + _i13.Future deleteConfig( + int? id, + _i8.ConfigType? type, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteConfig, + [ + id, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @@ -430,17 +696,25 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { _i8.ConfigType? type, ) => (super.noSuchMethod( - Invocation.method(#handleConfig, [entry, input, type]), + Invocation.method( + #handleConfig, + [ + entry, + input, + type, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override _i13.Future> fetchSessionData() => (super.noSuchMethod( - Invocation.method(#fetchSessionData, []), - returnValue: _i13.Future>.value( - <_i10.WorkoutSession>[], + Invocation.method( + #fetchSessionData, + [], ), + returnValue: _i13.Future>.value(<_i10.WorkoutSession>[]), ) as _i13.Future>); @override @@ -449,62 +723,105 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { int? routineId, ) => (super.noSuchMethod( - Invocation.method(#addSession, [session, routineId]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#addSession, [session, routineId]), - ), + Invocation.method( + #addSession, + [ + session, + routineId, + ], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #addSession, + [ + session, + routineId, + ], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i10.WorkoutSession> editSession(_i10.WorkoutSession? session) => (super.noSuchMethod( - Invocation.method(#editSession, [session]), - returnValue: _i13.Future<_i10.WorkoutSession>.value( - _FakeWorkoutSession_8( - this, - Invocation.method(#editSession, [session]), - ), + Invocation.method( + #editSession, + [session], ), + returnValue: _i13.Future<_i10.WorkoutSession>.value(_FakeWorkoutSession_8( + this, + Invocation.method( + #editSession, + [session], + ), + )), ) as _i13.Future<_i10.WorkoutSession>); @override _i13.Future<_i11.Log> addLog(_i11.Log? log) => (super.noSuchMethod( - Invocation.method(#addLog, [log]), - returnValue: _i13.Future<_i11.Log>.value( - _FakeLog_9(this, Invocation.method(#addLog, [log])), + Invocation.method( + #addLog, + [log], ), + returnValue: _i13.Future<_i11.Log>.value(_FakeLog_9( + this, + Invocation.method( + #addLog, + [log], + ), + )), ) as _i13.Future<_i11.Log>); @override - _i13.Future deleteLog(int? logId, int? routineId) => (super.noSuchMethod( - Invocation.method(#deleteLog, [logId, routineId]), + _i13.Future deleteLog( + int? logId, + int? routineId, + ) => + (super.noSuchMethod( + Invocation.method( + #deleteLog, + [ + logId, + routineId, + ], + ), returnValue: _i13.Future.value(), returnValueForMissingStub: _i13.Future.value(), ) as _i13.Future); @override void addListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#addListener, [listener]), + Invocation.method( + #addListener, + [listener], + ), returnValueForMissingStub: null, ); @override void removeListener(_i16.VoidCallback? listener) => super.noSuchMethod( - Invocation.method(#removeListener, [listener]), + Invocation.method( + #removeListener, + [listener], + ), returnValueForMissingStub: null, ); @override void dispose() => super.noSuchMethod( - Invocation.method(#dispose, []), + Invocation.method( + #dispose, + [], + ), returnValueForMissingStub: null, ); @override void notifyListeners() => super.noSuchMethod( - Invocation.method(#notifyListeners, []), + Invocation.method( + #notifyListeners, + [], + ), returnValueForMissingStub: null, ); } From 7e0910b56b320cbe4bc9b679f98d0df91c72ba99 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 May 2025 14:48:10 +0200 Subject: [PATCH 2/9] Handle network connectivity a bit different When the server is not reachable, we show a slightly different error message and remove the option to automatically create an issue. --- lib/helpers/{ui.dart => errors.dart} | 161 ++++++++++-------- lib/l10n/app_en.arb | 6 +- lib/main.dart | 21 ++- lib/screens/auth_screen.dart | 12 +- lib/screens/home_tabs_screen.dart | 4 +- lib/widgets/measurements/forms.dart | 6 +- lib/widgets/nutrition/forms.dart | 8 +- lib/widgets/routines/gym_mode/log_page.dart | 4 +- .../routines/gym_mode/session_page.dart | 4 +- lib/widgets/routines/log.dart | 2 +- lib/widgets/weight/forms.dart | 4 +- test/utils/errors_test.dart | 81 +++++++++ 12 files changed, 213 insertions(+), 100 deletions(-) rename lib/helpers/{ui.dart => errors.dart} (73%) create mode 100644 test/utils/errors_test.dart diff --git a/lib/helpers/ui.dart b/lib/helpers/errors.dart similarity index 73% rename from lib/helpers/ui.dart rename to lib/helpers/errors.dart index 8a61dc19..415dc48a 100644 --- a/lib/helpers/ui.dart +++ b/lib/helpers/errors.dart @@ -17,6 +17,7 @@ */ import 'dart:async'; +import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -31,41 +32,27 @@ import 'package:wger/main.dart'; import 'package:wger/models/workouts/log.dart'; import 'package:wger/providers/routines.dart'; -void showHttpExceptionErrorDialog( - WgerHttpException exception, - BuildContext context, -) { +void showHttpExceptionErrorDialog(WgerHttpException exception, {BuildContext? context}) { final logger = Logger('showHttpExceptionErrorDialog'); + // Attempt to get the BuildContext from our global navigatorKey. + // This allows us to show a dialog even if the error occurs outside + // of a widget's build method. + final BuildContext? dialogContext = context ?? navigatorKey.currentContext; + + if (dialogContext == null) { + if (kDebugMode) { + logger.warning('Error: Could not error show http error dialog because the context is null.'); + } + return; + } + logger.fine(exception.toString()); - final List errorList = []; - - for (final key in exception.errors!.keys) { - // Error headers - // Ensure that the error heading first letter is capitalized. - final String errorHeaderMsg = key[0].toUpperCase() + key.substring(1, key.length); - - errorList.add( - Text( - errorHeaderMsg.replaceAll('_', ' '), - style: const TextStyle(fontWeight: FontWeight.bold), - ), - ); - - // Error messages - if (exception.errors![key] is String) { - errorList.add(Text(exception.errors![key])); - } else { - for (final value in exception.errors![key]) { - errorList.add(Text(value)); - } - } - errorList.add(const SizedBox(height: 8)); - } + final errorList = extractErrors(exception.errors); showDialog( - context: context, + context: dialogContext, builder: (ctx) => AlertDialog( title: Text(AppLocalizations.of(ctx).anErrorOccurred), content: Column( @@ -83,10 +70,6 @@ void showHttpExceptionErrorDialog( ], ), ); - - // This call serves no purpose The dialog above doesn't seem to show - // unless this dummy call is present - //showDialog(context: context, builder: (context) => Container()); } void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext? context}) { @@ -100,13 +83,12 @@ void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext if (dialogContext == null) { if (kDebugMode) { logger.warning('Error: Could not error show dialog because the context is null.'); - logger.warning('Original error: $error'); - logger.warning('Original stackTrace: $stackTrace'); } return; } - // Determine the error title and message based on the error type. + // If possible, determine the error title and message based on the error type. + bool isNetworkError = false; String errorTitle = 'An error occurred'; String errorMessage = error.toString(); @@ -118,7 +100,9 @@ void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext errorTitle = 'Application Error'; errorMessage = error.exceptionAsString(); } else if (error is MissingRequiredKeysException) { - errorTitle = 'Missing Required Key '; + errorTitle = 'Missing Required Key'; + } else if (error is SocketException) { + isNetworkError = true; } final String fullStackTrace = stackTrace?.toString() ?? 'No stack trace available.'; @@ -133,11 +117,14 @@ void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext title: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Icon(Icons.error, color: Theme.of(context).colorScheme.error), + Icon( + isNetworkError ? Icons.signal_wifi_connected_no_internet_4_outlined : Icons.error, + color: Theme.of(context).colorScheme.error, + ), const SizedBox(width: 8), Expanded( child: Text( - i18n.anErrorOccurred, + isNetworkError ? i18n.errorCouldNotConnectToServer : i18n.anErrorOccurred, style: TextStyle(color: Theme.of(context).colorScheme.error), ), ), @@ -146,7 +133,11 @@ void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext content: SingleChildScrollView( child: ListBody( children: [ - Text(i18n.errorInfoDescription), + Text( + isNetworkError + ? i18n.errorCouldNotConnectToServerDetails + : i18n.errorInfoDescription, + ), const SizedBox(height: 8), Text(i18n.errorInfoDescription2), const SizedBox(height: 10), @@ -198,36 +189,37 @@ void showGeneralErrorDialog(dynamic error, StackTrace? stackTrace, {BuildContext ), ), actions: [ - TextButton( - child: const Text('Report issue'), - onPressed: () async { - const githubRepoUrl = 'https://github.com/wger-project/flutter'; - final description = Uri.encodeComponent( - '## Description\n\n' - '[Please describe what you were doing when the error occurred.]\n\n' - '## Error details\n\n' - 'Error title: $errorTitle\n' - 'Error message: $errorMessage\n' - 'Stack trace:\n' - '```\n$stackTrace\n```', - ); - final githubIssueUrl = '$githubRepoUrl/issues/new?template=1_bug.yml' - '&title=$errorTitle' - '&description=$description'; - final Uri reportUri = Uri.parse(githubIssueUrl); - - try { - await launchUrl(reportUri, mode: LaunchMode.externalApplication); - } catch (e) { - if (kDebugMode) logger.warning('Error launching URL: $e'); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('Error opening issue tracker: $e')), + if (!isNetworkError) + TextButton( + child: const Text('Report issue'), + onPressed: () async { + const githubRepoUrl = 'https://github.com/wger-project/flutter'; + final description = Uri.encodeComponent( + '## Description\n\n' + '[Please describe what you were doing when the error occurred.]\n\n' + '## Error details\n\n' + 'Error title: $errorTitle\n' + 'Error message: $errorMessage\n' + 'Stack trace:\n' + '```\n$stackTrace\n```', ); - } - }, - ), + final githubIssueUrl = '$githubRepoUrl/issues/new?template=1_bug.yml' + '&title=$errorTitle' + '&description=$description'; + final Uri reportUri = Uri.parse(githubIssueUrl); + + try { + await launchUrl(reportUri, mode: LaunchMode.externalApplication); + } catch (e) { + if (kDebugMode) logger.warning('Error launching URL: $e'); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Error opening issue tracker: $e')), + ); + } + }, + ), FilledButton( - child: const Text('OK'), + child: Text(MaterialLocalizations.of(context).okButtonLabel), onPressed: () { Navigator.of(context).pop(); }, @@ -279,3 +271,36 @@ void showDeleteDialog(BuildContext context, String confirmDeleteName, Log log) a ); return res; } + +List extractErrors(Map? errors) { + final List errorList = []; + + if (errors == null) { + return errorList; + } + + for (final key in errors.keys) { + // Error headers + // Ensure that the error heading first letter is capitalized. + final String errorHeaderMsg = key[0].toUpperCase() + key.substring(1, key.length); + + errorList.add( + Text( + errorHeaderMsg.replaceAll('_', ' '), + style: const TextStyle(fontWeight: FontWeight.bold), + ), + ); + + // Error messages + if (errors[key] is String) { + errorList.add(Text(errors[key])); + } else { + for (final value in errors[key]) { + errorList.add(Text(value)); + } + } + errorList.add(const SizedBox(height: 8)); + } + + return errorList; +} diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 3acc19a9..ef1c1b95 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -303,8 +303,10 @@ "goalFiber": "Fiber goal", "anErrorOccurred": "An Error Occurred!", "errorInfoDescription": "We're sorry, but something went wrong. You can help us fix this by reporting the issue on GitHub.", - "errorInfoDescription2": "You can continue using the app, but some features may not work as expected.", - "errorViewDetails": "View technical details", + "errorInfoDescription2": "You can continue using the app, but some features may not work.", + "errorViewDetails": "Technical details", + "errorCouldNotConnectToServer": "Couldn't connect to server", + "errorCouldNotConnectToServerDetails": "The application could not connect to the server. Please check your internet connection or the server URL and try again. If the problem persists, contact the server administrator.", "copyToClipboard": "Copy to clipboard", "weight": "Weight", "min": "Min", diff --git a/lib/main.dart b/lib/main.dart index a2f1b27b..879047cc 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -22,6 +22,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart' as riverpod; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; import 'package:wger/core/locator.dart'; +import 'package:wger/exceptions/http_exception.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/shared_preferences.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/providers/add_exercise.dart'; @@ -60,7 +62,6 @@ import 'package:wger/theme/theme.dart'; import 'package:wger/widgets/core/about.dart'; import 'package:wger/widgets/core/settings.dart'; -import 'helpers/ui.dart'; import 'providers/auth.dart'; void _setupLogging() { @@ -73,14 +74,15 @@ void _setupLogging() { final GlobalKey navigatorKey = GlobalKey(); void main() async { + // Needs to be called before runApp + WidgetsFlutterBinding.ensureInitialized(); + + // Logger _setupLogging(); final logger = Logger('main'); //zx.setLogEnabled(kDebugMode); - // Needs to be called before runApp - WidgetsFlutterBinding.ensureInitialized(); - // Locator to initialize exerciseDB await ServiceLocator().configure(); @@ -89,11 +91,12 @@ void main() async { // Catch errors from Flutter itself (widget build, layout, paint, etc.) FlutterError.onError = (FlutterErrorDetails details) { + final stack = details.stack ?? StackTrace.empty; if (kDebugMode) { FlutterError.dumpErrorToConsole(details); } - showGeneralErrorDialog(details.exception, details.stack ?? StackTrace.empty); - // Zone.current.handleUncaughtError(details.exception, details.stack ?? StackTrace.empty); + + showGeneralErrorDialog(details.exception, stack); }; // Catch errors that happen outside of the Flutter framework (e.g., in async operations) @@ -102,7 +105,11 @@ void main() async { logger.warning('Caught error by PlatformDispatcher: $error'); logger.warning('Stack trace: $stack'); } - showGeneralErrorDialog(error, stack); + if (error is WgerHttpException) { + showHttpExceptionErrorDialog(error); + } else { + showGeneralErrorDialog(error, stack); + } // Return true to indicate that the error has been handled. return true; diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 218ed770..4229f950 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -22,7 +22,7 @@ import 'package:flutter/services.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/helpers/ui.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/screens/update_app_screen.dart'; import 'package:wger/theme/theme.dart'; @@ -195,24 +195,22 @@ class _AuthCardState extends State { ); return; } - setState(() { _isLoading = false; }); } on WgerHttpException catch (error) { if (mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } setState(() { _isLoading = false; }); - } catch (error, stackTrace) { - if (mounted) { - showGeneralErrorDialog(error, stackTrace, context: context); - } + rethrow; + } catch (error) { setState(() { _isLoading = false; }); + rethrow; } } diff --git a/lib/screens/home_tabs_screen.dart b/lib/screens/home_tabs_screen.dart index a1792fbe..8bbf4826 100644 --- a/lib/screens/home_tabs_screen.dart +++ b/lib/screens/home_tabs_screen.dart @@ -22,7 +22,7 @@ import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart'; import 'package:wger/exceptions/http_exception.dart'; -import 'package:wger/helpers/ui.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight.dart'; @@ -101,7 +101,7 @@ class _HomeTabsScreenState extends State with SingleTickerProvid } on WgerHttpException catch (error) { widget._logger.warning('Wger exception loading base data'); if (mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } diff --git a/lib/widgets/measurements/forms.dart b/lib/widgets/measurements/forms.dart index e77ec62b..2b8a05f6 100644 --- a/lib/widgets/measurements/forms.dart +++ b/lib/widgets/measurements/forms.dart @@ -19,8 +19,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/measurements/measurement_category.dart'; import 'package:wger/models/measurements/measurement_entry.dart'; @@ -123,7 +123,7 @@ class MeasurementCategoryForm extends StatelessWidget { ); } on WgerHttpException catch (error) { if (context.mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } if (context.mounted) { @@ -296,7 +296,7 @@ class MeasurementEntryForm extends StatelessWidget { ); } on WgerHttpException catch (error) { if (context.mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } if (context.mounted) { diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 2a5ecca2..0d1ab082 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -20,8 +20,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/nutrition/ingredient.dart'; import 'package:wger/models/nutrition/log.dart'; @@ -106,7 +106,7 @@ class MealForm extends StatelessWidget { listen: false, ).editMeal(_meal); } on WgerHttpException catch (error) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } Navigator.of(context).pop(); }, @@ -411,7 +411,7 @@ class IngredientFormState extends State { ); widget.onSave(context, _mealItem, date); } on WgerHttpException catch (error) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } Navigator.of(context).pop(); }, @@ -690,7 +690,7 @@ class _PlanFormState extends State { _descriptionController.clear(); } on WgerHttpException catch (error) { if (context.mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } }, diff --git a/lib/widgets/routines/gym_mode/log_page.dart b/lib/widgets/routines/gym_mode/log_page.dart index 852a037d..b7752b55 100644 --- a/lib/widgets/routines/gym_mode/log_page.dart +++ b/lib/widgets/routines/gym_mode/log_page.dart @@ -20,8 +20,8 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart' as provider; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/gym_mode.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/log.dart'; @@ -315,7 +315,7 @@ class _LogPageState extends State { _isSaving = false; } on WgerHttpException catch (error) { if (mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } _isSaving = false; } diff --git a/lib/widgets/routines/gym_mode/session_page.dart b/lib/widgets/routines/gym_mode/session_page.dart index 956bf17f..8dde53f8 100644 --- a/lib/widgets/routines/gym_mode/session_page.dart +++ b/lib/widgets/routines/gym_mode/session_page.dart @@ -20,9 +20,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart' as provider; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/helpers/misc.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/routine.dart'; @@ -237,7 +237,7 @@ class _SessionPageState extends State { } } on WgerHttpException catch (error) { if (mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } }, diff --git a/lib/widgets/routines/log.dart b/lib/widgets/routines/log.dart index 52bc3863..e6156d4b 100644 --- a/lib/widgets/routines/log.dart +++ b/lib/widgets/routines/log.dart @@ -19,8 +19,8 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:wger/helpers/colors.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/misc.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/log.dart'; import 'package:wger/models/workouts/routine.dart'; diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index d279a918..8b9a7b24 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -21,8 +21,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; import 'package:wger/providers/body_weight.dart'; @@ -179,7 +179,7 @@ class WeightForm extends StatelessWidget { : await provider.editEntry(_weightEntry); } on WgerHttpException catch (error) { if (context.mounted) { - showHttpExceptionErrorDialog(error, context); + showHttpExceptionErrorDialog(error, context: context); } } diff --git a/test/utils/errors_test.dart b/test/utils/errors_test.dart new file mode 100644 index 00000000..e618365b --- /dev/null +++ b/test/utils/errors_test.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:wger/helpers/errors.dart'; + +void main() { + group('extractErrors', () { + testWidgets('Returns empty list when errors is null', (WidgetTester tester) async { + final result = extractErrors(null); + expect(result, isEmpty); + }); + + testWidgets('Returns empty list when errors is empty', (WidgetTester tester) async { + final result = extractErrors({}); + expect(result, isEmpty); + }); + + testWidgets('Processes string values correctly', (WidgetTester tester) async { + // Arrange + final errors = {'error': 'Something went wrong'}; + + // Act + final widgets = extractErrors(errors); + + // Assert + expect(widgets.length, 3, reason: 'Expected 3 widgets: header, message, and spacing'); + + final headerWidget = widgets[0] as Text; + expect(headerWidget.data, 'Error'); + + final messageWidget = widgets[1] as Text; + expect(messageWidget.data, 'Something went wrong'); + expect(widgets[2] is SizedBox, true); + }); + + testWidgets('Processes list values correctly', (WidgetTester tester) async { + // Arrange + final errors = { + 'validation_error': ['Error 1', 'Error 2'], + }; + + // Act + final widgets = extractErrors(errors); + + // Assert + expect(widgets.length, 4); + + final headerWidget = widgets[0] as Text; + expect(headerWidget.data, 'Validation error'); + + final messageWidget1 = widgets[1] as Text; + expect(messageWidget1.data, 'Error 1'); + + final messageWidget2 = widgets[2] as Text; + expect(messageWidget2.data, 'Error 2'); + }); + + testWidgets('Processes multiple error types correctly', (WidgetTester tester) async { + // Arrange + final errors = { + 'username': ['Username is too boring', 'Username is too short'], + 'password': 'Password does not match', + }; + + // Act + final widgets = extractErrors(errors); + + // Assert + expect(widgets.length, 7); + + final textWidgets = widgets.whereType().toList(); + expect(textWidgets.map((w) => w.data).contains('Username'), true); + expect(textWidgets.map((w) => w.data).contains('Password'), true); + expect(textWidgets.map((w) => w.data).contains('Username is too boring'), true); + expect(textWidgets.map((w) => w.data).contains('Username is too short'), true); + expect(textWidgets.map((w) => w.data).contains('Password does not match'), true); + + final spacers = widgets.whereType().toList(); + expect(spacers.length, 2); + }); + }); +} From 013721ba7108b4d3e3938943e8b31d416750694a Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Thu, 8 May 2025 22:06:48 +0200 Subject: [PATCH 3/9] Refactor WgerHttpException We can now use a widget to show any errors returned by WgerHttpException. This has to be added on a form-by-form basis, otherwise, the general error handling shows the results in a modal dialog --- lib/exceptions/http_exception.dart | 8 +- lib/helpers/errors.dart | 83 ++++++++++++---- lib/screens/auth_screen.dart | 32 +++--- lib/screens/home_tabs_screen.dart | 23 ++--- lib/widgets/measurements/forms.dart | 96 ++++++++---------- lib/widgets/nutrition/forms.dart | 98 ++++++++----------- lib/widgets/routines/gym_mode/log_page.dart | 8 +- .../routines/gym_mode/session_page.dart | 22 ++--- lib/widgets/weight/forms.dart | 16 +-- test/auth/auth_screen_test.dart | 4 +- test/utils/errors_test.dart | 55 ++++------- 11 files changed, 213 insertions(+), 232 deletions(-) diff --git a/lib/exceptions/http_exception.dart b/lib/exceptions/http_exception.dart index ca38f0a2..06cd2915 100644 --- a/lib/exceptions/http_exception.dart +++ b/lib/exceptions/http_exception.dart @@ -19,7 +19,7 @@ import 'dart:convert'; class WgerHttpException implements Exception { - Map? errors; + Map errors = {}; /// Custom http exception. /// Expects the response body of the REST call and will try to parse it to @@ -37,8 +37,12 @@ class WgerHttpException implements Exception { } } + WgerHttpException.fromMap(Map map) { + errors = map; + } + @override String toString() { - return errors!.values.toList().join(', '); + return errors.values.toList().join(', '); } } diff --git a/lib/helpers/errors.dart b/lib/helpers/errors.dart index 415dc48a..2acbd22b 100644 --- a/lib/helpers/errors.dart +++ b/lib/helpers/errors.dart @@ -47,9 +47,7 @@ void showHttpExceptionErrorDialog(WgerHttpException exception, {BuildContext? co return; } - logger.fine(exception.toString()); - - final errorList = extractErrors(exception.errors); + final errorList = formatErrors(extractErrors(exception.errors)); showDialog( context: dialogContext, @@ -272,35 +270,78 @@ void showDeleteDialog(BuildContext context, String confirmDeleteName, Log log) a return res; } -List extractErrors(Map? errors) { - final List errorList = []; +class ApiError { + final String key; + late List errorMessages = []; - if (errors == null) { - return errorList; + ApiError({required this.key, this.errorMessages = const []}); + + @override + String toString() { + return 'ApiError(key: $key, errorMessage: $errorMessages)'; } +} + +/// Extracts error messages from the server response +List extractErrors(Map errors) { + final List errorList = []; for (final key in errors.keys) { - // Error headers - // Ensure that the error heading first letter is capitalized. - final String errorHeaderMsg = key[0].toUpperCase() + key.substring(1, key.length); + // Header + var header = key[0].toUpperCase() + key.substring(1, key.length); + header = header.replaceAll('_', ' '); + final error = ApiError(key: header); + final messages = errors[key]; + + // Messages + if (messages is String) { + error.errorMessages = List.of(error.errorMessages)..add(messages); + } else { + error.errorMessages = [...error.errorMessages, ...messages]; + } + + errorList.add(error); + } + + return errorList; +} + +/// Processes the error messages from the server and returns a list of widgets +List formatErrors(List errors, {Color? color}) { + final textColor = color ?? Colors.black; + + final List errorList = []; + + for (final error in errors) { errorList.add( - Text( - errorHeaderMsg.replaceAll('_', ' '), - style: const TextStyle(fontWeight: FontWeight.bold), - ), + Text(error.key, style: TextStyle(fontWeight: FontWeight.bold, color: textColor)), ); - // Error messages - if (errors[key] is String) { - errorList.add(Text(errors[key])); - } else { - for (final value in errors[key]) { - errorList.add(Text(value)); - } + for (final message in error.errorMessages) { + errorList.add(Text(message, style: TextStyle(color: textColor))); } errorList.add(const SizedBox(height: 8)); } return errorList; } + +class FormErrorsWidget extends StatelessWidget { + final WgerHttpException exception; + + const FormErrorsWidget(this.exception, {super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Icon(Icons.error_outline, color: Theme.of(context).colorScheme.error), + ...formatErrors( + extractErrors(exception.errors), + color: Theme.of(context).colorScheme.error, + ), + ], + ); + } +} diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 4229f950..3b8f7f68 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -105,6 +105,7 @@ class AuthCard extends StatefulWidget { class _AuthCardState extends State { bool isObscure = true; bool confirmIsObscure = true; + Widget errorMessage = const SizedBox.shrink(); final GlobalKey _formKey = GlobalKey(); AuthMode _authMode = AuthMode.Login; @@ -195,21 +196,25 @@ class _AuthCardState extends State { ); return; } - setState(() { - _isLoading = false; - }); - } on WgerHttpException catch (error) { - if (mounted) { - showHttpExceptionErrorDialog(error, context: context); + if (context.mounted) { + setState(() { + _isLoading = false; + }); + } + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + _isLoading = false; + errorMessage = FormErrorsWidget(error); + }); } - setState(() { - _isLoading = false; - }); - rethrow; } catch (error) { - setState(() { - _isLoading = false; - }); + if (context.mounted) { + setState(() { + _isLoading = false; + }); + } + rethrow; } } @@ -248,6 +253,7 @@ class _AuthCardState extends State { child: AutofillGroup( child: Column( children: [ + errorMessage, TextFormField( key: const Key('inputUsername'), decoration: InputDecoration( diff --git a/lib/screens/home_tabs_screen.dart b/lib/screens/home_tabs_screen.dart index 8bbf4826..2694b17a 100644 --- a/lib/screens/home_tabs_screen.dart +++ b/lib/screens/home_tabs_screen.dart @@ -21,8 +21,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:logging/logging.dart'; import 'package:provider/provider.dart'; import 'package:rive/rive.dart'; -import 'package:wger/exceptions/http_exception.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/providers/auth.dart'; import 'package:wger/providers/body_weight.dart'; @@ -90,20 +88,13 @@ class _HomeTabsScreenState extends State with SingleTickerProvid // Base data widget._logger.info('Loading base data'); - try { - await Future.wait([ - authProvider.setServerVersion(), - userProvider.fetchAndSetProfile(), - routinesProvider.fetchAndSetUnits(), - nutritionPlansProvider.fetchIngredientsFromCache(), - exercisesProvider.fetchAndSetInitialData(), - ]); - } on WgerHttpException catch (error) { - widget._logger.warning('Wger exception loading base data'); - if (mounted) { - showHttpExceptionErrorDialog(error, context: context); - } - } + await Future.wait([ + authProvider.setServerVersion(), + userProvider.fetchAndSetProfile(), + routinesProvider.fetchAndSetUnits(), + nutritionPlansProvider.fetchIngredientsFromCache(), + exercisesProvider.fetchAndSetInitialData(), + ]); // Plans, weight and gallery widget._logger.info('Loading routines, weight, measurements and gallery'); diff --git a/lib/widgets/measurements/forms.dart b/lib/widgets/measurements/forms.dart index 2b8a05f6..b0039824 100644 --- a/lib/widgets/measurements/forms.dart +++ b/lib/widgets/measurements/forms.dart @@ -18,8 +18,6 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:wger/exceptions/http_exception.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/measurements/measurement_category.dart'; @@ -101,31 +99,26 @@ class MeasurementCategoryForm extends StatelessWidget { _form.currentState!.save(); // Save the entry on the server - try { - categoryData['id'] == null - ? await Provider.of( - context, - listen: false, - ).addCategory( - MeasurementCategory( - id: categoryData['id'], - name: categoryData['name'], - unit: categoryData['unit'], - ), - ) - : await Provider.of( - context, - listen: false, - ).editCategory( - categoryData['id'], - categoryData['name'], - categoryData['unit'], - ); - } on WgerHttpException catch (error) { - if (context.mounted) { - showHttpExceptionErrorDialog(error, context: context); - } - } + categoryData['id'] == null + ? await Provider.of( + context, + listen: false, + ).addCategory( + MeasurementCategory( + id: categoryData['id'], + name: categoryData['name'], + unit: categoryData['unit'], + ), + ) + : await Provider.of( + context, + listen: false, + ).editCategory( + categoryData['id'], + categoryData['name'], + categoryData['unit'], + ); + if (context.mounted) { Navigator.of(context).pop(); } @@ -272,33 +265,28 @@ class MeasurementEntryForm extends StatelessWidget { _form.currentState!.save(); // Save the entry on the server - try { - _entryData['id'] == null - ? await Provider.of( - context, - listen: false, - ).addEntry(MeasurementEntry( - id: _entryData['id'], - category: _entryData['category'], - date: _entryData['date'], - value: _entryData['value'], - notes: _entryData['notes'], - )) - : await Provider.of( - context, - listen: false, - ).editEntry( - _entryData['id'], - _entryData['category'], - _entryData['value'], - _entryData['notes'], - _entryData['date'], - ); - } on WgerHttpException catch (error) { - if (context.mounted) { - showHttpExceptionErrorDialog(error, context: context); - } - } + _entryData['id'] == null + ? await Provider.of( + context, + listen: false, + ).addEntry(MeasurementEntry( + id: _entryData['id'], + category: _entryData['category'], + date: _entryData['date'], + value: _entryData['value'], + notes: _entryData['notes'], + )) + : await Provider.of( + context, + listen: false, + ).editEntry( + _entryData['id'], + _entryData['category'], + _entryData['value'], + _entryData['notes'], + _entryData['date'], + ); + if (context.mounted) { Navigator.of(context).pop(); } diff --git a/lib/widgets/nutrition/forms.dart b/lib/widgets/nutrition/forms.dart index 0d1ab082..ad5b7aa4 100644 --- a/lib/widgets/nutrition/forms.dart +++ b/lib/widgets/nutrition/forms.dart @@ -18,9 +18,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; -import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/nutrition/ingredient.dart'; @@ -89,25 +87,22 @@ class MealForm extends StatelessWidget { ElevatedButton( key: const Key(SUBMIT_BUTTON_KEY_NAME), child: Text(AppLocalizations.of(context).save), - onPressed: () async { + onPressed: () { if (!_form.currentState!.validate()) { return; } _form.currentState!.save(); - try { - _meal.id == null - ? Provider.of( - context, - listen: false, - ).addMeal(_meal, _planId) - : Provider.of( - context, - listen: false, - ).editMeal(_meal); - } on WgerHttpException catch (error) { - showHttpExceptionErrorDialog(error, context: context); - } + _meal.id == null + ? Provider.of( + context, + listen: false, + ).addMeal(_meal, _planId) + : Provider.of( + context, + listen: false, + ).editMeal(_meal); + Navigator.of(context).pop(); }, ), @@ -399,20 +394,17 @@ class IngredientFormState extends State { _form.currentState!.save(); _mealItem.ingredientId = int.parse(_ingredientIdController.text); - try { - var date = DateTime.parse(_dateController.text); - final tod = stringToTime(_timeController.text); - date = DateTime( - date.year, - date.month, - date.day, - tod.hour, - tod.minute, - ); - widget.onSave(context, _mealItem, date); - } on WgerHttpException catch (error) { - showHttpExceptionErrorDialog(error, context: context); - } + var date = DateTime.parse(_dateController.text); + final tod = stringToTime(_timeController.text); + date = DateTime( + date.year, + date.month, + date.day, + tod.hour, + tod.minute, + ); + widget.onSave(context, _mealItem, date); + Navigator.of(context).pop(); }, ), @@ -664,35 +656,29 @@ class _PlanFormState extends State { _form.currentState!.save(); // Save to DB - try { - if (widget._plan.id != null) { - await Provider.of( - context, - listen: false, - ).editPlan(widget._plan); - if (context.mounted) { - Navigator.of(context).pop(); - } - } else { - widget._plan = await Provider.of( - context, - listen: false, - ).addPlan(widget._plan); - if (context.mounted) { - Navigator.of(context).pushReplacementNamed( - NutritionalPlanScreen.routeName, - arguments: widget._plan, - ); - } - } - - // Saving was successful, reset the data - _descriptionController.clear(); - } on WgerHttpException catch (error) { + if (widget._plan.id != null) { + await Provider.of( + context, + listen: false, + ).editPlan(widget._plan); if (context.mounted) { - showHttpExceptionErrorDialog(error, context: context); + Navigator.of(context).pop(); + } + } else { + widget._plan = await Provider.of( + context, + listen: false, + ).addPlan(widget._plan); + if (context.mounted) { + Navigator.of(context).pushReplacementNamed( + NutritionalPlanScreen.routeName, + arguments: widget._plan, + ); } } + + // Saving was successful, reset the data + _descriptionController.clear(); }, ), ], diff --git a/lib/widgets/routines/gym_mode/log_page.dart b/lib/widgets/routines/gym_mode/log_page.dart index b7752b55..17ace6e7 100644 --- a/lib/widgets/routines/gym_mode/log_page.dart +++ b/lib/widgets/routines/gym_mode/log_page.dart @@ -20,7 +20,6 @@ import 'package:intl/intl.dart'; import 'package:provider/provider.dart' as provider; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/gym_mode.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/exercises/exercise.dart'; @@ -313,11 +312,10 @@ class _LogPageState extends State { curve: DEFAULT_ANIMATION_CURVE, ); _isSaving = false; - } on WgerHttpException catch (error) { - if (mounted) { - showHttpExceptionErrorDialog(error, context: context); - } + } on WgerHttpException { _isSaving = false; + + rethrow; } }, child: diff --git a/lib/widgets/routines/gym_mode/session_page.dart b/lib/widgets/routines/gym_mode/session_page.dart index 8dde53f8..d1c4ebde 100644 --- a/lib/widgets/routines/gym_mode/session_page.dart +++ b/lib/widgets/routines/gym_mode/session_page.dart @@ -18,9 +18,7 @@ import 'package:clock/clock.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart' as provider; -import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/helpers/misc.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; @@ -225,20 +223,14 @@ class _SessionPageState extends State { _form.currentState!.save(); // Save the entry on the server - try { - if (widget._session.id == null) { - await routinesProvider.addSession(widget._session, widget._routine.id!); - } else { - await routinesProvider.editSession(widget._session); - } + if (widget._session.id == null) { + await routinesProvider.addSession(widget._session, widget._routine.id!); + } else { + await routinesProvider.editSession(widget._session); + } - if (mounted) { - Navigator.of(context).pop(); - } - } on WgerHttpException catch (error) { - if (mounted) { - showHttpExceptionErrorDialog(error, context: context); - } + if (mounted) { + Navigator.of(context).pop(); } }, ), diff --git a/lib/widgets/weight/forms.dart b/lib/widgets/weight/forms.dart index 8b9a7b24..73c7c6fe 100644 --- a/lib/widgets/weight/forms.dart +++ b/lib/widgets/weight/forms.dart @@ -19,9 +19,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; -import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; -import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/body_weight/weight_entry.dart'; @@ -172,16 +170,10 @@ class WeightForm extends StatelessWidget { _form.currentState!.save(); // Save the entry on the server - try { - final provider = Provider.of(context, listen: false); - _weightEntry.id == null - ? await provider.addEntry(_weightEntry) - : await provider.editEntry(_weightEntry); - } on WgerHttpException catch (error) { - if (context.mounted) { - showHttpExceptionErrorDialog(error, context: context); - } - } + final provider = Provider.of(context, listen: false); + _weightEntry.id == null + ? await provider.addEntry(_weightEntry) + : await provider.editEntry(_weightEntry); if (context.mounted) { Navigator.of(context).pop(); diff --git a/test/auth/auth_screen_test.dart b/test/auth/auth_screen_test.dart index b030e7cc..17967417 100644 --- a/test/auth/auth_screen_test.dart +++ b/test/auth/auth_screen_test.dart @@ -146,7 +146,7 @@ void main() { )); }); - testWidgets('Login - wront username & password', (WidgetTester tester) async { + testWidgets('Login - wrong username & password', (WidgetTester tester) async { // Arrange await tester.binding.setSurfaceSize(const Size(1080, 1920)); tester.view.devicePixelRatio = 1.0; @@ -168,7 +168,6 @@ void main() { await tester.pumpAndSettle(); // Assert - expect(find.textContaining('An Error Occurred'), findsOne); expect(find.textContaining('Non field errors'), findsOne); expect(find.textContaining('Username or password unknown'), findsOne); verify(mockClient.post( @@ -259,7 +258,6 @@ void main() { await tester.pumpAndSettle(); // Assert - expect(find.textContaining('An Error Occurred'), findsOne); expect(find.textContaining('This password is too common'), findsOne); expect(find.textContaining('This password is entirely numeric'), findsOne); expect(find.textContaining('This field must be unique'), findsOne); diff --git a/test/utils/errors_test.dart b/test/utils/errors_test.dart index e618365b..975e6f61 100644 --- a/test/utils/errors_test.dart +++ b/test/utils/errors_test.dart @@ -1,14 +1,8 @@ -import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:wger/helpers/errors.dart'; void main() { group('extractErrors', () { - testWidgets('Returns empty list when errors is null', (WidgetTester tester) async { - final result = extractErrors(null); - expect(result, isEmpty); - }); - testWidgets('Returns empty list when errors is empty', (WidgetTester tester) async { final result = extractErrors({}); expect(result, isEmpty); @@ -19,17 +13,14 @@ void main() { final errors = {'error': 'Something went wrong'}; // Act - final widgets = extractErrors(errors); + final result = extractErrors(errors); // Assert - expect(widgets.length, 3, reason: 'Expected 3 widgets: header, message, and spacing'); + expect(result.length, 1, reason: 'Expected 1 error'); + expect(result[0].errorMessages.length, 1, reason: '1 error message'); - final headerWidget = widgets[0] as Text; - expect(headerWidget.data, 'Error'); - - final messageWidget = widgets[1] as Text; - expect(messageWidget.data, 'Something went wrong'); - expect(widgets[2] is SizedBox, true); + expect(result[0].key, 'Error'); + expect(result[0].errorMessages[0], 'Something went wrong'); }); testWidgets('Processes list values correctly', (WidgetTester tester) async { @@ -39,19 +30,12 @@ void main() { }; // Act - final widgets = extractErrors(errors); + final result = extractErrors(errors); // Assert - expect(widgets.length, 4); - - final headerWidget = widgets[0] as Text; - expect(headerWidget.data, 'Validation error'); - - final messageWidget1 = widgets[1] as Text; - expect(messageWidget1.data, 'Error 1'); - - final messageWidget2 = widgets[2] as Text; - expect(messageWidget2.data, 'Error 2'); + expect(result[0].key, 'Validation error'); + expect(result[0].errorMessages[0], 'Error 1'); + expect(result[0].errorMessages[1], 'Error 2'); }); testWidgets('Processes multiple error types correctly', (WidgetTester tester) async { @@ -62,20 +46,21 @@ void main() { }; // Act - final widgets = extractErrors(errors); + final result = extractErrors(errors); // Assert - expect(widgets.length, 7); + expect(result.length, 2); + final error1 = result[0]; + final error2 = result[1]; - final textWidgets = widgets.whereType().toList(); - expect(textWidgets.map((w) => w.data).contains('Username'), true); - expect(textWidgets.map((w) => w.data).contains('Password'), true); - expect(textWidgets.map((w) => w.data).contains('Username is too boring'), true); - expect(textWidgets.map((w) => w.data).contains('Username is too short'), true); - expect(textWidgets.map((w) => w.data).contains('Password does not match'), true); + expect(error1.key, 'Username'); + expect(error1.errorMessages.length, 2); + expect(error1.errorMessages[0], 'Username is too boring'); + expect(error1.errorMessages[1], 'Username is too short'); - final spacers = widgets.whereType().toList(); - expect(spacers.length, 2); + expect(error2.key, 'Password'); + expect(error2.errorMessages.length, 1); + expect(error2.errorMessages[0], 'Password does not match'); }); }); } From f8000a54545974cf7ddca4f093e27721da5bf3d5 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 13:54:58 +0200 Subject: [PATCH 4/9] Catch and handle WgerHttpException specially This shows the server errors directly in the form, instead of a modal dialog (which is the default for all the other forms and places that throw the exception) --- lib/helpers/errors.dart | 4 +- lib/main.dart | 5 ++ lib/screens/auth_screen.dart | 15 ++---- lib/widgets/routines/forms/day.dart | 56 +++++++++++++++-------- lib/widgets/routines/forms/routine.dart | 25 ++++++---- lib/widgets/routines/forms/slot.dart | 61 +++++++++++++++++++++---- test/workout/routine_form_test.dart | 56 ++++++++++++++++++----- 7 files changed, 161 insertions(+), 61 deletions(-) diff --git a/lib/helpers/errors.dart b/lib/helpers/errors.dart index 2acbd22b..5397d0d2 100644 --- a/lib/helpers/errors.dart +++ b/lib/helpers/errors.dart @@ -327,10 +327,10 @@ List formatErrors(List errors, {Color? color}) { return errorList; } -class FormErrorsWidget extends StatelessWidget { +class FormHttpErrorsWidget extends StatelessWidget { final WgerHttpException exception; - const FormErrorsWidget(this.exception, {super.key}); + const FormHttpErrorsWidget(this.exception, {super.key}); @override Widget build(BuildContext context) { diff --git a/lib/main.dart b/lib/main.dart index 879047cc..dd2577f3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -96,6 +96,11 @@ void main() async { FlutterError.dumpErrorToConsole(details); } + // Don't show the full error dialog for network image loading errors. + if (details.exception is NetworkImageLoadException) { + return; + } + showGeneralErrorDialog(details.exception, stack); }; diff --git a/lib/screens/auth_screen.dart b/lib/screens/auth_screen.dart index 3b8f7f68..1095b2e1 100644 --- a/lib/screens/auth_screen.dart +++ b/lib/screens/auth_screen.dart @@ -41,7 +41,7 @@ class AuthScreen extends StatelessWidget { @override Widget build(BuildContext context) { - final deviceSize = MediaQuery.of(context).size; + final deviceSize = MediaQuery.sizeOf(context); return Scaffold( backgroundColor: Theme.of(context).colorScheme.surface, body: Stack( @@ -204,18 +204,13 @@ class _AuthCardState extends State { } on WgerHttpException catch (error) { if (context.mounted) { setState(() { - _isLoading = false; - errorMessage = FormErrorsWidget(error); + errorMessage = FormHttpErrorsWidget(error); }); } - } catch (error) { - if (context.mounted) { - setState(() { - _isLoading = false; - }); + } finally { + if (mounted) { + setState(() => _isLoading = false); } - - rethrow; } } diff --git a/lib/widgets/routines/forms/day.dart b/lib/widgets/routines/forms/day.dart index a09a101f..d5a6fc38 100644 --- a/lib/widgets/routines/forms/day.dart +++ b/lib/widgets/routines/forms/day.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/day.dart'; import 'package:wger/providers/routines.dart'; @@ -56,6 +58,8 @@ class ReorderableDaysList extends StatefulWidget { } class _ReorderableDaysListState extends State { + Widget errorMessage = const SizedBox.shrink(); + @override Widget build(BuildContext context) { final i18n = AppLocalizations.of(context); @@ -63,6 +67,7 @@ class _ReorderableDaysListState extends State { return Column( children: [ + errorMessage, ReorderableListView.builder( buildDefaultDragHandles: false, shrinkWrap: true, @@ -120,7 +125,18 @@ class _ReorderableDaysListState extends State { } }); - provider.editDays(widget.days); + try { + provider.editDays(widget.days); + setState(() { + errorMessage = const SizedBox.shrink(); + }); + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } + } }, ), Card( @@ -161,6 +177,8 @@ class DayFormWidget extends StatefulWidget { } class _DayFormWidgetState extends State { + Widget errorMessage = const SizedBox.shrink(); + final descriptionController = TextEditingController(); final nameController = TextEditingController(); late bool isRestDay; @@ -193,6 +211,7 @@ class _DayFormWidgetState extends State { key: _form, child: Column( children: [ + errorMessage, Text( widget.day.isRest ? i18n.restDay : widget.day.name, style: Theme.of(context).textTheme.titleLarge, @@ -292,25 +311,24 @@ class _DayFormWidgetState extends State { try { await Provider.of(context, listen: false) .editDay(widget.day); - } catch (error) { - await showDialog( - context: context, - builder: (ctx) => AlertDialog( - title: const Text('An error occurred!'), - content: const Text('Something went wrong.'), - actions: [ - TextButton( - child: const Text('Okay'), - onPressed: () { - Navigator.of(ctx).pop(); - }, - ), - ], - ), - ); + if (context.mounted) { + setState(() { + errorMessage = const SizedBox.shrink(); + }); + } + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } + } finally { + if (mounted) { + setState(() { + isSaving = false; + }); + } } - - setState(() => isSaving = false); }, child: isSaving ? const FormProgressIndicator() : Text(AppLocalizations.of(context).save), diff --git a/lib/widgets/routines/forms/routine.dart b/lib/widgets/routines/forms/routine.dart index f39e803f..d8bb5bd1 100644 --- a/lib/widgets/routines/forms/routine.dart +++ b/lib/widgets/routines/forms/routine.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:provider/provider.dart'; +import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/routine.dart'; import 'package:wger/providers/routines.dart'; @@ -20,6 +22,7 @@ class RoutineForm extends StatefulWidget { class _RoutineFormState extends State { final _form = GlobalKey(); + Widget errorMessage = const SizedBox.shrink(); bool isSaving = false; late bool fitInWeek; @@ -50,6 +53,7 @@ class _RoutineFormState extends State { final i18n = AppLocalizations.of(context); final children = [ + errorMessage, TextFormField( key: const Key('field-name'), decoration: InputDecoration(labelText: i18n.name), @@ -225,19 +229,22 @@ class _RoutineFormState extends State { ); } } - } catch (e) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('${i18n.anErrorOccurred} $e')), - ); + setState(() { + errorMessage = const SizedBox.shrink(); + }); + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } } finally { if (mounted) { - setState(() => isSaving = false); + setState(() { + isSaving = false; + }); } } - - setState(() { - isSaving = false; - }); }, child: isSaving ? const FormProgressIndicator() : Text(AppLocalizations.of(context).save), ), diff --git a/lib/widgets/routines/forms/slot.dart b/lib/widgets/routines/forms/slot.dart index 9425b189..043ca71c 100644 --- a/lib/widgets/routines/forms/slot.dart +++ b/lib/widgets/routines/forms/slot.dart @@ -18,7 +18,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/exercises/exercise.dart'; import 'package:wger/models/workouts/day.dart'; @@ -89,6 +91,8 @@ class _SlotEntryFormState extends State { final maxRestController = TextEditingController(); final rirController = TextEditingController(); + Widget errorMessage = const SizedBox.shrink(); + final _form = GlobalKey(); var _edit = false; @@ -154,6 +158,7 @@ class _SlotEntryFormState extends State { key: _form, child: Column( children: [ + errorMessage, ListTile( title: Text( widget.entry.exerciseObj.getTranslation(languageCode).name, @@ -177,9 +182,18 @@ class _SlotEntryFormState extends State { ? null : () async { setState(() => isDeleting = true); - await provider.deleteSlotEntry(widget.entry.id!, widget.routineId); - if (mounted) { - setState(() => isDeleting = false); + try { + await provider.deleteSlotEntry(widget.entry.id!, widget.routineId); + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } + } finally { + if (mounted) { + setState(() => isDeleting = false); + } } }, ), @@ -385,11 +399,14 @@ class _SlotEntryFormState extends State { await provider.editSlotEntry(widget.entry, widget.routineId); if (mounted) { setState(() => isSaving = false); + errorMessage = const SizedBox.shrink(); + } + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); } - } catch (e) { - ScaffoldMessenger.of(context).showSnackBar( - SnackBar(content: Text('${i18n.anErrorOccurred} $e')), - ); } finally { if (mounted) { setState(() => isSaving = false); @@ -419,6 +436,7 @@ class SlotDetailWidget extends StatefulWidget { class _SlotDetailWidgetState extends State { bool _showExerciseSearchBox = false; + Widget errorMessage = const SizedBox.shrink(); @override Widget build(BuildContext context) { @@ -427,6 +445,7 @@ class _SlotDetailWidgetState extends State { return Column( children: [ + errorMessage, ...widget.slot.entries.map((entry) => entry.hasProgressionRules ? ProgressionRulesInfoBox(entry.exerciseObj) : SlotEntryForm(entry, widget.routineId, simpleMode: widget.simpleMode)), @@ -442,7 +461,18 @@ class _SlotDetailWidgetState extends State { exercise: exercise, ); - await provider.addSlotEntry(entry, widget.routineId); + try { + await provider.addSlotEntry(entry, widget.routineId); + if (context.mounted) { + setState(() => errorMessage = const SizedBox.shrink()); + } + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } + } }, ), if (widget.slot.entries.isNotEmpty) @@ -473,6 +503,7 @@ class _SlotFormWidgetStateNg extends State { bool simpleMode = true; bool isAddingSlot = false; int? isDeletingSlot; + Widget errorMessage = const SizedBox.shrink(); @override Widget build(BuildContext context) { @@ -482,6 +513,7 @@ class _SlotFormWidgetStateNg extends State { return Column( children: [ + errorMessage, if (!widget.day.isRest) SwitchListTile( value: simpleMode, @@ -579,7 +611,18 @@ class _SlotFormWidgetStateNg extends State { widget.slots[i].order = i + 1; } - provider.editSlots(widget.slots, widget.day.routineId); + try { + provider.editSlots(widget.slots, widget.day.routineId); + setState(() { + errorMessage = const SizedBox.shrink(); + }); + } on WgerHttpException catch (error) { + if (context.mounted) { + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); + } + } }); }, ), diff --git a/test/workout/routine_form_test.dart b/test/workout/routine_form_test.dart index 214eeb42..c52c5cd8 100644 --- a/test/workout/routine_form_test.dart +++ b/test/workout/routine_form_test.dart @@ -21,6 +21,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; +import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/routine.dart'; @@ -74,7 +75,7 @@ void main() { ); } - testWidgets('Test the widgets on the workout form', (WidgetTester tester) async { + testWidgets('Test the widgets on the routine form', (WidgetTester tester) async { await tester.pumpWidget(renderWidget(existingRoutine)); await tester.pumpAndSettle(); @@ -82,19 +83,19 @@ void main() { expect(find.byType(ElevatedButton), findsOneWidget); }); - testWidgets('Test editing an existing workout', (WidgetTester tester) async { + testWidgets('Test editing an existing routine', (WidgetTester tester) async { await tester.pumpWidget(renderWidget(existingRoutine)); await tester.pumpAndSettle(); expect( find.text('test 1'), findsOneWidget, - reason: 'Name of existing workout plan', + reason: 'Name of existing routine', ); expect( find.text('description 1'), findsOneWidget, - reason: 'Description of existing workout plan', + reason: 'Description of existing routine', ); await tester.enterText(find.byKey(const Key('field-name')), 'New description'); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); @@ -112,13 +113,28 @@ void main() { //expect(find.text(('New description')), findsOneWidget, reason: 'Workout plan detail page'); }); - testWidgets('Test creating a new workout - only name', (WidgetTester tester) async { + testWidgets('Test editing an existing routine - server error', (WidgetTester tester) async { + // Arrange + when(mockRoutinesProvider.editRoutine(any)).thenThrow(WgerHttpException.fromMap({ + 'name': ['The name is not valid'], + })); + + // Act + await tester.pumpWidget(renderWidget(existingRoutine)); + await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); + await tester.pump(); + + // Assert + expect(find.text('The name is not valid'), findsOneWidget, reason: 'Error message is shown'); + }); + + testWidgets('Test creating a new routine - only name', (WidgetTester tester) async { final editRoutine = Routine( id: 2, created: newRoutine.created, start: DateTime(2024, 11, 1), end: DateTime(2024, 12, 1), - name: 'New cool workout', + name: 'New cool routine', ); when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editRoutine)); @@ -127,7 +143,7 @@ void main() { await tester.pumpWidget(renderWidget(newRoutine)); await tester.pumpAndSettle(); - expect(find.text(''), findsNWidgets(2), reason: 'New workout has no name or description'); + expect(find.text(''), findsNWidgets(2), reason: 'New routine has no name or description'); await tester.enterText(find.byKey(const Key('field-name')), editRoutine.name); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); @@ -136,16 +152,16 @@ void main() { // Detail page await tester.pumpAndSettle(); - expect(find.text('New cool workout'), findsWidgets, reason: 'Workout plan detail page'); + expect(find.text('New cool routine'), findsWidgets, reason: 'routine detail page'); }); - testWidgets('Test creating a new workout - name and description', (WidgetTester tester) async { + testWidgets('Test creating a new routine - name and description', (WidgetTester tester) async { final editRoutine = Routine( id: 2, created: newRoutine.created, start: DateTime(2024, 11, 1), end: DateTime(2024, 12, 1), - name: 'My workout', + name: 'My routine', description: 'Get yuuuge', ); when(mockRoutinesProvider.addRoutine(any)).thenAnswer((_) => Future.value(editRoutine)); @@ -154,7 +170,7 @@ void main() { await tester.pumpWidget(renderWidget(newRoutine)); await tester.pumpAndSettle(); - expect(find.text(''), findsNWidgets(2), reason: 'New workout has no name or description'); + expect(find.text(''), findsNWidgets(2), reason: 'New routine has no name or description'); await tester.enterText(find.byKey(const Key('field-name')), editRoutine.name); await tester.enterText(find.byKey(const Key('field-description')), editRoutine.description); await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); @@ -164,6 +180,22 @@ void main() { // Detail page await tester.pumpAndSettle(); - expect(find.text('My workout'), findsWidgets, reason: 'Workout plan detail page'); + expect(find.text('My routine'), findsWidgets, reason: 'routine detail page'); + }); + + testWidgets('Test creating a new routine - server error', (WidgetTester tester) async { + // Arrange + when(mockRoutinesProvider.addRoutine(any)).thenThrow(WgerHttpException.fromMap({ + 'name': ['The name is not valid'], + })); + + // Act + await tester.pumpWidget(renderWidget(newRoutine)); + await tester.enterText(find.byKey(const Key('field-name')), 'test 1234'); + await tester.tap(find.byKey(const Key(SUBMIT_BUTTON_KEY_NAME))); + await tester.pump(); + + // Assert + expect(find.text('The name is not valid'), findsOneWidget, reason: 'Error message is shown'); }); } From 7cde4e82ea95ceed62e825ef709872e78ae36f9c Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 14:12:47 +0200 Subject: [PATCH 5/9] Recreate generated files --- test/workout/day_form_test.mocks.dart | 26 +++++++++---------- .../gym_mode_session_screen_test.mocks.dart | 26 +++++++++---------- ...epetition_unit_form_widget_test.mocks.dart | 26 +++++++++---------- .../routine_edit_screen_test.mocks.dart | 26 +++++++++---------- test/workout/routine_edit_test.mocks.dart | 26 +++++++++---------- test/workout/routine_form_test.mocks.dart | 26 +++++++++---------- .../routine_logs_screen_test.mocks.dart | 26 +++++++++---------- test/workout/slot_entry_form_test.mocks.dart | 26 +++++++++---------- .../weight_unit_form_widget_test.mocks.dart | 26 +++++++++---------- 9 files changed, 117 insertions(+), 117 deletions(-) diff --git a/test/workout/day_form_test.mocks.dart b/test/workout/day_form_test.mocks.dart index c8a20ef3..12eabddc 100644 --- a/test/workout/day_form_test.mocks.dart +++ b/test/workout/day_form_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/gym_mode_session_screen_test.mocks.dart b/test/workout/gym_mode_session_screen_test.mocks.dart index e63ffb2e..45a4f4b9 100644 --- a/test/workout/gym_mode_session_screen_test.mocks.dart +++ b/test/workout/gym_mode_session_screen_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/repetition_unit_form_widget_test.mocks.dart b/test/workout/repetition_unit_form_widget_test.mocks.dart index da5982b6..aff5b092 100644 --- a/test/workout/repetition_unit_form_widget_test.mocks.dart +++ b/test/workout/repetition_unit_form_widget_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/routine_edit_screen_test.mocks.dart b/test/workout/routine_edit_screen_test.mocks.dart index 3b326f26..43191349 100644 --- a/test/workout/routine_edit_screen_test.mocks.dart +++ b/test/workout/routine_edit_screen_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/routine_edit_test.mocks.dart b/test/workout/routine_edit_test.mocks.dart index e92d7d1f..3be95e00 100644 --- a/test/workout/routine_edit_test.mocks.dart +++ b/test/workout/routine_edit_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/routine_form_test.mocks.dart b/test/workout/routine_form_test.mocks.dart index 38354316..577db580 100644 --- a/test/workout/routine_form_test.mocks.dart +++ b/test/workout/routine_form_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/routine_logs_screen_test.mocks.dart b/test/workout/routine_logs_screen_test.mocks.dart index ce4460a2..f62965ba 100644 --- a/test/workout/routine_logs_screen_test.mocks.dart +++ b/test/workout/routine_logs_screen_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/slot_entry_form_test.mocks.dart b/test/workout/slot_entry_form_test.mocks.dart index 22b0fe23..9dbed8b3 100644 --- a/test/workout/slot_entry_form_test.mocks.dart +++ b/test/workout/slot_entry_form_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), diff --git a/test/workout/weight_unit_form_widget_test.mocks.dart b/test/workout/weight_unit_form_widget_test.mocks.dart index bf52b7f6..89c64de8 100644 --- a/test/workout/weight_unit_form_widget_test.mocks.dart +++ b/test/workout/weight_unit_form_widget_test.mocks.dart @@ -188,6 +188,15 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ), ) as _i4.RepetitionUnit); + @override + set activeRoutine(_i5.Routine? _activeRoutine) => super.noSuchMethod( + Invocation.setter( + #activeRoutine, + _activeRoutine, + ), + returnValueForMissingStub: null, + ); + @override set weightUnits(List<_i3.WeightUnit>? weightUnits) => super.noSuchMethod( Invocation.setter( @@ -285,18 +294,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as int); @override - void setCurrentPlan(int? id) => super.noSuchMethod( + void setActiveRoutine() => super.noSuchMethod( Invocation.method( - #setCurrentPlan, - [id], - ), - returnValueForMissingStub: null, - ); - - @override - void resetCurrentRoutine() => super.noSuchMethod( - Invocation.method( - #resetCurrentRoutine, + #setActiveRoutine, [], ), returnValueForMissingStub: null, @@ -313,9 +313,9 @@ class MockRoutinesProvider extends _i1.Mock implements _i12.RoutinesProvider { ) as _i13.Future); @override - _i13.Future fetchAndSetAllPlansSparse() => (super.noSuchMethod( + _i13.Future fetchAndSetAllRoutinesSparse() => (super.noSuchMethod( Invocation.method( - #fetchAndSetAllPlansSparse, + #fetchAndSetAllRoutinesSparse, [], ), returnValue: _i13.Future.value(), From aafb2c90c86fe557320f8d40efb442b789aa329d Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 14:16:45 +0200 Subject: [PATCH 6/9] Delete unused file --- lib/widgets/routines/forms/weight.dart | 58 -------------------------- 1 file changed, 58 deletions(-) delete mode 100644 lib/widgets/routines/forms/weight.dart diff --git a/lib/widgets/routines/forms/weight.dart b/lib/widgets/routines/forms/weight.dart deleted file mode 100644 index e918da5d..00000000 --- a/lib/widgets/routines/forms/weight.dart +++ /dev/null @@ -1,58 +0,0 @@ -/* - * This file is part of wger Workout Manager . - * Copyright (C) 2020, 2021 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. - * - * wger Workout Manager 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 . - */ - -import 'package:flutter/material.dart'; -import 'package:wger/l10n/generated/app_localizations.dart'; -import 'package:wger/models/workouts/slot_entry.dart'; - -class WeightInputWidget extends StatelessWidget { - final _weightController = TextEditingController(); - final SlotEntry _setting; - final bool _detailed; - - WeightInputWidget(this._setting, this._detailed); - - @override - Widget build(BuildContext context) { - return TextFormField( - decoration: InputDecoration( - labelText: _detailed ? AppLocalizations.of(context).weight : '', - errorMaxLines: 2, - ), - controller: _weightController, - keyboardType: TextInputType.number, - validator: (value) { - try { - if (value != '') { - double.parse(value!); - } - } catch (error) { - return AppLocalizations.of(context).enterValidNumber; - } - return null; - }, - onChanged: (newValue) { - if (newValue != '') { - try { - // _setting.weight = double.parse(newValue); - } catch (e) {} - } - }, - ); - } -} From 7141e264800cc9f2c8e3c416fc4d21e549e2fe85 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 21:23:09 +0200 Subject: [PATCH 7/9] Update SessionForm test --- lib/widgets/routines/forms/session.dart | 16 ++++++++++------ test/workout/forms/session_form_test.dart | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/widgets/routines/forms/session.dart b/lib/widgets/routines/forms/session.dart index 79d0006e..1c6ab5cc 100644 --- a/lib/widgets/routines/forms/session.dart +++ b/lib/widgets/routines/forms/session.dart @@ -21,8 +21,8 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/helpers/consts.dart'; +import 'package:wger/helpers/errors.dart'; import 'package:wger/helpers/json.dart'; -import 'package:wger/helpers/ui.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/session.dart'; import 'package:wger/providers/routines.dart'; @@ -51,6 +51,7 @@ class SessionForm extends StatefulWidget { } class _SessionFormState extends State { + Widget errorMessage = const SizedBox.shrink(); final _form = GlobalKey(); final impressionController = TextEditingController(); @@ -90,6 +91,7 @@ class _SessionFormState extends State { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ + errorMessage, ToggleButtons( renderBorder: false, onPressed: (int index) { @@ -219,16 +221,18 @@ class _SessionFormState extends State { await routinesProvider.editSession(widget._session); } + setState(() { + errorMessage = const SizedBox.shrink(); + }); + if (context.mounted && widget._onSaved != null) { widget._onSaved!(); } } on WgerHttpException catch (error) { if (context.mounted) { - showHttpExceptionErrorDialog(error, context); - } - } catch (error) { - if (context.mounted) { - showErrorDialog(error, context); + setState(() { + errorMessage = FormHttpErrorsWidget(error); + }); } } }, diff --git a/test/workout/forms/session_form_test.dart b/test/workout/forms/session_form_test.dart index d10af65e..01a90524 100644 --- a/test/workout/forms/session_form_test.dart +++ b/test/workout/forms/session_form_test.dart @@ -4,6 +4,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; import 'package:provider/provider.dart'; +import 'package:wger/exceptions/http_exception.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/session.dart'; import 'package:wger/providers/routines.dart'; @@ -126,5 +127,20 @@ void main() { expect(captured.notes, 'Updated notes'); expect(onSavedCalled, isTrue); }); + + testWidgets('shows server side error messages', (WidgetTester tester) async { + // Arrange + await pumpSessionForm(tester); + when(mockRoutinesProvider.addSession(any, any)).thenThrow(WgerHttpException.fromMap({ + 'name': ['The name is not valid'], + })); + + // Act + await tester.tap(find.byKey(const ValueKey('save-button'))); + await tester.pumpAndSettle(); + + // Assert + expect(find.text('The name is not valid'), findsOneWidget, reason: 'Error message is shown'); + }); }); } From e9435cd4aaa990d66ba73858997dfd761010b536 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 21:46:09 +0200 Subject: [PATCH 8/9] Fix test --- lib/widgets/routines/forms/session.dart | 2 ++ test/workout/gym_mode_session_screen_test.dart | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/widgets/routines/forms/session.dart b/lib/widgets/routines/forms/session.dart index 1c6ab5cc..4bb6d6cd 100644 --- a/lib/widgets/routines/forms/session.dart +++ b/lib/widgets/routines/forms/session.dart @@ -130,6 +130,7 @@ class _SessionFormState extends State { children: [ Flexible( child: TextFormField( + key: const ValueKey('time-start'), decoration: InputDecoration( labelText: AppLocalizations.of(context).timeStart, errorMaxLines: 2, @@ -172,6 +173,7 @@ class _SessionFormState extends State { const SizedBox(width: 10), Flexible( child: TextFormField( + key: const ValueKey('time-end'), decoration: InputDecoration( labelText: AppLocalizations.of(context).timeEnd, ), diff --git a/test/workout/gym_mode_session_screen_test.dart b/test/workout/gym_mode_session_screen_test.dart index a865b154..bb5c77f4 100644 --- a/test/workout/gym_mode_session_screen_test.dart +++ b/test/workout/gym_mode_session_screen_test.dart @@ -25,6 +25,7 @@ import 'package:provider/provider.dart'; import 'package:wger/helpers/json.dart'; import 'package:wger/l10n/generated/app_localizations.dart'; import 'package:wger/models/workouts/routine.dart'; +import 'package:wger/models/workouts/session.dart'; import 'package:wger/providers/routines.dart'; import 'package:wger/widgets/routines/gym_mode/session_page.dart'; @@ -77,12 +78,17 @@ void main() { testWidgets('Test that data from session is loaded - null times', (WidgetTester tester) async { testRoutine.sessions[0].session.timeStart = null; testRoutine.sessions[0].session.timeEnd = null; - final timeNow = timeToString(TimeOfDay.now())!; withClock(Clock.fixed(DateTime(2021, 5, 1)), () async { await tester.pumpWidget(renderSessionPage()); - expect(find.text('13:35'), findsOneWidget); - expect(find.text(timeNow), findsOneWidget); + + final startTimeField = find.byKey(const ValueKey('time-start')); + expect(startTimeField, findsOneWidget); + expect(tester.widget(startTimeField).controller!.text, ''); + + final endTimeField = find.byKey(const ValueKey('time-end')); + expect(endTimeField, findsOneWidget); + expect(tester.widget(endTimeField).controller!.text, ''); }); }); @@ -101,7 +107,8 @@ void main() { withClock(Clock.fixed(DateTime(2021, 5, 1)), () async { await tester.pumpWidget(renderSessionPage()); await tester.tap(find.byKey(const ValueKey('save-button'))); - final captured = verify(mockRoutinesProvider.editSession(captureAny)).captured.single; + final captured = + verify(mockRoutinesProvider.editSession(captureAny)).captured.single as WorkoutSession; expect(captured.id, 1); expect(captured.impression, 3); From 7c06b66b23a07ce2f226a9cfb98e89aa5224c717 Mon Sep 17 00:00:00 2001 From: Roland Geider Date: Fri, 9 May 2025 21:53:11 +0200 Subject: [PATCH 9/9] Update goldens --- .../goldens/routine_logs_screen_detail.png | Bin 9861 -> 10017 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/test/workout/goldens/routine_logs_screen_detail.png b/test/workout/goldens/routine_logs_screen_detail.png index df0489219804525f8e9a42e54e2057a88add0c64..eb48d4746b0536f53cf539202afec921dbf33c56 100644 GIT binary patch literal 10017 zcmdT~dpwkB-@iTD)OL_cM9g+XXp#_ysfbEaC_=QXSVEdG4ufi2i%b5E*iciNRoo8OEI7dlb+1)NWhv^E~h8_0N1<_jTX*b^U(d@Ar4O?ucVYjaPgx z^F06nD-InrGzS0?1^|c-FIfzZD4t$!0RD&|%#HU0n5GRQ;6IBH`wv+z0sn%Q{1grV zKLCde_gNy7$9qt>dwfuDCka~&ZvJ@i(Uw(tGBUE;+|80Q^}fq~_V)Rt5Kgd6K^HB4y7h8Ty4j4s0(hzSqZrk{S=M!;TlY9D>qCQgUMz{8UH&xO4 zOaHb@4LxvJ*L~?-_`VdZ-;jDPG4(tg-^XM=^BY2yYrVjkipIHV0HMb{?9!zGpzUb0 z$PXg>#6lM>k^@$+x(FQH`}YSD!=}ziH6?0qsnag;5?tTlqPYCE2Jg52(%OC-sw;`V zD>3@FzDrT^zQe%v&@|D#|1e<3b0Q^C^}pNR1&*QRbbu{C%wM{^5?H$AF9)h-PEF`1 z$pNEvD?cpt%)!13P9YI*y}O&_jmIR2Kaloxazlx?nu_i z*H^wIG5ofiR}~NhcZk;LCP3S6eWeY)Y^6_T2>o5y5(xlqPGNs$$`l< zL4)4DRz7*aidkEUDE8=-8ISB*M&RuR-F(W;v-4GqIWdUP^UTTD);0@K-qG9JTXK$H zR*9&O_pN3Zrf8(XWoTu&_IbNXOSL4?${f4byL8t%bYZZ++wmOg#hBwz4d$(YiQx!} zXIVMTPL(+3*ZwwT#J}i|{`(pTF5dpyEnP|kXsew^#YcAwZQt%O9Oa=~B&AOqmCU}M z9q1H+jca+0%c6BZ&5+AzUoYW(zK?H?Ft|sKL6=O_QkD_0W>;FnIhMXfV}u3|+ae>* zz)U5=V6gI(x=G_}j{fT@8*6+~KCS!MdQ<$Bo(Jl(O?}T7K>mpb{&HY%>)s3-55^`S z^i9V-kRqQDhr6{a9xc z-NQNg@tt|+qnX_}-Lu7oaXRG4IF{v8T6fuFBRdiZwX5XdS0CVKPKKy5XNy#A(^1}m z{n*qtgt3{OA8Gn3S!Pm4zr-sf3!D1RuVy4=M84~@HvYuupA3A7MY~f+L@1gUYm4N% zmO+ry*G_-{%d75wIXv2HiJapNB`SQ++)~s#ySii(8dI&1n0R+3-M|Gpp>gk?oaZ$~g_oRfZ!kxsj}-2-WA^+#?|tGB`EXv{(pX2tt&8ue7mat=&sJnxJ-&vSh`vhp?0Ty4Mygl}9r%G;lfBm4~BUvdXoV zJl!K}(vb6h5%H?yiiJ(#;a4~_35m+t3nbSV=)IkSBTw|GJGMxZ|GKR)C4`mT-hpDO5I$FbcjEFZl#g8l<|82wojd{%!yVZ&1* zvMWBPrMv`3>pnk>{k*wUjz1vs%fcJkHNs_+t~}M453htVEk`I_Dkx)=5{!}IjK@|eJ@o&)Z&j| z^d;|{uQj`7`>*)lI&{*=ikUeV`EJ{|sODoP2Zu&OqTkzo!_3S~tuvi0iIz1bOfHz9 zDx(*lUCW;4tj`q?X76J9{+o>bWW^t(RTAB`AV?C#VSgB|g#nAX>dvsy(<6{ZRBhi# zP>8lQEdNI$UNV@aN$)F#9w&N@cO9W4viWs%&j%B|z8LiZ zj~a4LTY7HYL#A{WIlC7?J#$B-ceY2j$)`kome_wT3!8`XyNzGE^#5aLQFOa}=R7BO zGgO)P9gd3uRT~Xrh4%ih8ShhT%Ew#@4kFh%5fdg9Va3Sj10^I3yOB4P6rzq1q|1I! zh?~sO>${fpOmi(-IncwaWOl`5p;u52&Cak|3f^PkhIxp?1v*W?IdPS|tM6916RO3# z@l_?F(9X8Aa~#qsVX@6j$*1Z54*Vlrn_Z{7GDn8;=84+b;>H~?t6Gj1H#cMG&Dp{O z)bid+gjd%pAyV!=FQ8d)9hLk(j(>GQ^<)U z-vHMCRNas$ivxgB@<<_tG>c{W?{h~F3z$sy5=LRn6Td0p~&X{|B=;vyO$z z0*o2!PxmB!PgsbL*$T{e86Tlnm@tnf&t(KwX75X{F%)(oSEJPE`DZ;KVq!_mUa%OL zma{SxxOhQfT7x`lWPV?}JraYitp z3P<&3tjlN}B=6D5I;Xc03h6A3+=$8CM0pYvd15!-^X!q?*A5Xw#PZA*le4SlS6o4R zgx(_&2c^c4LImR8Q(b}IH^!uDs&2EJa`&F$3Z%gxPYLsgZZm2YS)DyM6{U^lwYfNg zuW;Aztv1;agXqmyX)1MXzy3J(-sWLo=?Mqq#_i80WS(9Z+{w(m!x+*!K)LC+l(S@$ z@FIWI>%LcO{KIlu<&zZBNS&Xj|B1$RzkA6v{@sIt>>>)JbB`$_8vY&m(s#BrJ9Ggjr zwy(tNOjjAFPsQOq8M|t?qzO7KNvRlap;*e9Z|QtcWfho}8K?^5^R-3sxu1=NBbvkU}Tz zV!7O>cBq4jZI&c2@H~lvGka|(fb^TBSr2}h7#{~3&0N$>@AdH3OJ(V#B4S`ziGxoQ$$8V&T2RTgx6_QZOD$rMhedUt!t$%Tn-R^^ed&-WsJ1?%VjevbZR~QevnH=4oiyI9q4AFEa(cINCbt;w_B)m( zu}|!v<3O&%>RW;|eu$c9w{q|{dvAoxZqsCICW7w8RrL!swCVGAh6%3lyt%mo-)8l` z5WXQdbxj><}4CQziQ*n2AXwNeZ!cmR>JFX#e_aNZ88j#|Crx+t`{O z5u?kXWn-iweV;A*sIe>v$BP^Tfk2XHMrU6~s6utSxb)me#4~+qQfADU7fM#SY!JM; zp33)4epaYkYnl@9rjARRo0`9sF+0dfPDI zw0C-T@?ns_A0uQ4;XO*b5guMLK@%rIVwtJFLuO5aP9*6!2+yJ<0v~*+pq&0v=r`+P z4T~rcmujGZ#E=A>?8!^9s4e;|UT>@ZM967>p9U_jFY-`Ac@~C}z5#?!I)8$SmoYJ; z=jG)F_D}|t9m*9F>tb^`rHXY9*F>e$gDG0U>b>*{0r#dr-{Va|$)IS6%20ZgoKA%_ zvj-PQx+KP|zGbE_seZO0ybnpwP;-8H+XxzYSr`Fm@w#8tqo0rIUrsHX?Wk*l{rU{N zhllS~A}pHju0|1NB+woD`;Il9MQbGUa)%`nWG{bI-aVC1H zMuZeSZ-SL?-DbhmL0Itc;Ad1(PuJOp_qBULtf89DB5FN^2sdPQXS2A^o)V(%LG zayKqz`!R#HJgxmv-GW$V-R0sPQShKXNX=MLr}y*kq^jQ`wu#p$0cR|AXU6i7j27ec zVm~j&7~7FMDjU3Y2a2BIP07shZh0K(rXMWSkDNh3;M8L}+2R3-jH|b*fs}C)@9gn* zY>fOz=-AQZJrWRBBs_LPHE94x#cHz8AXJCy0g=(7yDtT4FE>`y?&2x_RzQdEV z54;2x_ptl-;VCA5wF6fp)3dU&hS@;qK36xlYgfHaOFNWuF#8c#FY_C{Q0l#W4pp&K z6G#iax@=vI7Jj;MzdCs7cRXx0Vu*X8#YY7A&hEmb>_ES<{Epogio;?Med$}-uXHxD^t^$h(sTdGB6c>lEca;b$|z&r(j?lRX;!YR&= z&6Qm`9b&QWKVLiC_oDx_1h7igVq5iI=jI5EAoZSCcZZw?``J*pV`$i>n`>%0Ha4CbX6QjdJ#uVj*&7(RTK9*213WZS(I?3gI*MBJ|AK z{T@SCj=_($s}jP((HmkT2-gD~+L2K|B77*|39G1Q=>r@I<`WwY6a z2zn;kDxkcD(EnTfp%&lcwj-?Y@FHSDlEa1Rn;onO@Sr5V?+Hw^uN3Qva3-#oXyF|5 z%EF%Zo47WpoFIkH9+V+=7i7{lEKew1%&Xvwde_8Rwb5@w)%+&9JMvx3Mp*0B&sJB7 z!@Hl*jSXS6ak2Z(<|bL4H)tE$9)YhN98ajLwbhJAi%G8(BH=4fk}s78YcHd1cE%r9 z*>pIhidaarvn65!Le_NNzZ&V-Qh6ZbY`y*Fs4WYY7aqmLLGgWrzBC@t>(rsMHTLjmY>TY`LCavX4{C{`}|?2dGA z#_uh!=!1qLwg9jgFZ>q3I95LT=hnw+{|_s#5t>L#->6`!W3`So7b@=0DjcE#AOR?r9ytsEtol!P~3%nL)&@a!$nUZ-kj ziCp>gk$bcF7<`qLo&NznGuCPZxhYyNaOO4|U&fp2K-Sm3qC41bbO*J$MmPd2K&IqLZ1|6_eN9q(ctI` z{6Zx=cj9yfMJtKVe8@;qK|KX~gWhKZmtN5&BzS~rV@hXE202zQP-R=HI+np*0JbqC zaCeNnwoL$kxFuZ;OlDruc|2ar8yh~qW))1#7`?Ia#aP88pmV1wwqPPY z&ZIT>8>sQPBN=3O-uFF!PC*ll{c3kl8w=!0#azrj_!GfiJMTfsY1p92yc0%PvAmkP zfk-_E6+QSo3H{yhVZsb83=&+z;C>_L9#V|)F^j^)Au(c*peKwV2Zz4v7%|}2$~(*0 zIA)J5gq<%QhfY;l0OkM|Ip{IcXw@Ey#312i>NCrf#pYA(gME$ph73QV#qIoP;Ml=zQ!iU zretl6#y;-zBqy>0c)DR5Ts74ZL>Ve=RK*4y%JMNX6h1t7JE9?R&0i zz+(NzOS9XEbwUuVQ?WS)9^{hq#?Ez;o#>g3d9MBUD-k=_j><4ZIpWolR`$mU7Uk95 zScDS+t(QS|X}BXH4(Fb)YJ#topPdnH*_D-X&mB19>i-S95_U{R&p=?945jTT1(VdV z=VB1Xph|i2cVOD`!E6O!FZrjr5Occk0#&zNN^AzAs0Wc~5!i(kpnE_vb>!DMPHEo) zqm53GVrD8F_ahk|z;Hd1q?yAAGOSM4Mz|%4otXtc+`(b?i2;l2QtydYNN<@(!M{5c ze$u2Cc8dY65ZaJ1oMn&`K7=y{_gOCsGyCp=e&-W9)b7d7i84ylEBZXa0)iEzrpf2G zz{JjcWgP)#J8pcH88ES1IT8>$@KL|`W9iz^D=7lBywBNET)~v(_m2{tkJ@ANGVQHeU*b#nM+}4fJ^{bhRs|OEGa9ZrAHZqRYMjXPOy@6_4(%(q9E@*ED}z{vi3BD)^ZjaOl8ML(Kj& Gm;VR1e~jJ$ literal 9861 zcmc&)d0bQ1wmz0tst6QNK}N4s(JDqnKp+rQlqw=BR%TF;K}Io!1OkcHq98+RQE6f*TcD3od0*LZc!_Axvk-&GxG}5)KEMLPH((uH&;Pn1)nm782s62-?tJn-p6sfopv!gVoL|bSWcjLQ z&BW_XL)?43=hdEepS~gktoYIh_Xx~SD+o^ifrU9=a2{TIf zJqfeVegHpn70q#aKVjz@KuJAh4EX6n>RbDX<=G_;MT*OS_C}dc-`*#9o zG-6n!QY5bwDKiDzk=Dp%bvS7X_b7PlgH&-#Dg!{22%x-O^Fr^V%S;HZZ2pM_bx z!czibUN;_YF)WeqT(YSWrN0JO6+tTePCe9zxE|(gZ%E7jQDu>XX|c#G zt3sm_WgF;(c_|%9ov8366kVS7BNeHA+WtSZyVTcyvUY@mt)=w-W3x5Bwz<*MIIE4L zCoK@9(b|RmICz=Y-xEk4YLUJ&SQSQ@zZ0+-N;Q?X(w(;H=_!QimIV&1RkJi+Ns>;A zp*C;V>l)*oAo-rItIVr~*LiFc$b_V{27HZ??EAz>-gx4Z+c~)(0A>pQ5DyNmoC`B5 zRc^diwMf~=Asx5Jrh87f1q6T3_1g|Da|`v#3hvZ(xNw=JR^4eftlwrg{-8`K>k_+9rI!It;0KON;9sFx( z*-g`GST+Y0)>AS}nf?vGwaVGc9)-P=UEf^laLDb60e}hjMex6q-N`cvBb|YhSEq~- zt4$fb-}$ChdD%o)yh)q>tFP~7blQ_9k>$jHOST(xCkh$;k8?boD3^nsBdO?aJRWcN z$oq5_3wr|<&g=AVD=1E9^vlw!vkmeHI_qf7EB% z@AvS)wLQG(RS4^5|3FA^YtcH{{CkB(9{Eg8ZeN=FS&QL{dt*ymp$y}@;BhLQ!E10T zS3UW-by?(Fa&ij+4cJz__P_-GznX!_>7_+RMJ)gW%*9M!=%vE0@{o=RFiD+|d6P!8 zTmD470K2a5kTOHB|JZe6B7eu1?-~9Eh#W9i73YDIeKlf+IAbty6q&b<`(Sc1f;$~u zF*TLZYTwxa_e{FI6&2Tlj0+SmI8U82OeM20o@m>+*g`^fYv(ubr1(eFNpZ=&UHv7H zYWhx@THLi+Q;+&1w7abzxgwo$u`AC(VZh|hq2}E9XIh^BE)h+Jh_%|87$te5fS5(;Pv1AP>(@ zukwNqSFC9=w#+TU*>}yJhsP0!pbolzTV=)X%YOm?otVBo%cehMq6KK8ibxk-N-O(A z!vAnyeTZC(lc$!^3_=<>ca2wSAg3PcfyFqhzW)s<13)hvr{#EY-X={gd}*<_gW_0c`j?`g?jR-N=M@q~N^{DS?&BL7b1crP&* z4Q7_Q)~3`<^m)7ZB9RE~Wfw0|Gkg7>#Zs`XBANueH4%5*$_LdA@4T(4!D{Yr9n|Wc zBL*C306kQh?@=BPCs(7~0#GRD#_p~zMX9ygIW(p8aonm#+N-zZ=iGRK8Boj_^PBv* zx}v0)^4iqFR7&vz(?5r^+fZG%}|GIn_5x5O%OYGvHwF9OG?LeY0sTLM?HIgx}=~ATq=HbGZ z)fuB#d%MaYoq3Kn$n7kXaoC{7UAnysG7smw)wqh1ZtULMeir22_V2nvu7kYm@8Rk` zpkmO_!{K0}JEL?!J`ykyQ;AK4Z;EuBR8mpcE7q!dYTl8SN@KAr;~noZH*eH+di z4qS^9zfa9W)~yMe>Y#6iBJ`J{{$4ftQ^SX}rXg&B6zsC?UMMO*D*Mjl07UavLfFr(yw7qz z!@Dji&$oSs&IVtf(ujzNf>Uj^3)-9r$~>`?;MVBk1&M+17F|5;+T>lZSS7=K4`s)P^XDU18c0UaPWZf%&{6*M~QFG4C!KeAKkPtUu8OX23kEzXdKtHPzgDL-nB>a+mZSt zI+mirGp{2V&o&n^o3)*f8HW}QQ%A{P8kv0tL37QZyn8KjR`Y~kAmJzsv?|p1Wh*vS z;y$DKioQX_mGF^#q0vJWzP(*9*6RnE9mKokqKinTG1;H9bHj#_3fSC<`tg@7F2wS$ z#{lRC+J57R!GEtSK^S29D3rJKVo4tS0=j)wSp3# zDiM1O5>BnE6B$m`y?O;5z(76ZhqDP{^=RBlM^^8Cfc~WfqZj+S{N8aV+ zRJ&A*OKtfE(9P{XvPglTt+U>?#g8LTT(d_~DSZ=8^i2G&mC|ck(}Cy9h`+4JSFL`M zQ(O`^FWUH1oOroZ{t0)OLvhr>bfmxi3ZojOj-9j;oq~9X&ANjL+eML{kkkEO!s_^e zSq#Pz_Tp93=hbbCfcv-bmtL}u)LF(_P z%#H7!0U?+ZgN^|O*+!$*)cwSP8(u%V6DoSGHJ9vuB56^XA$dewimg2m! zx(y3#=fh}O^a$&sq#Xe(!1R0>P-*&&zrU69K3c6o;~7k4^;r-x7o!zjl=90%{mnC8 zTxX?#fVs&bqsz8XM_s|3mQTPif4e#F7$>?Eq~OAIXI^!zO4}KFzK+yFU}p9&lRt}U z)MM5nWb2~|v)TV5g;OIFn3yBDD6i$#jo7keg(T~ctIW%xQZq7hE4g@4Y1SzaD)Oq<=_ZRLMAN02SfUr&{JDrQXiJKZacG^ph|wSS zLL2o8UzVhEG`$*i!E})H(K=#26N7RC*+DrIs~Q&-MZ<%7pSS`Dnh;khKj zN`pB?2(}dAq>z9f%~UD%yb6XtXq0_TGiU^ZF*Ic`u|zfUxG{wy?9%IMm?Y1}-8|o* zqEc!4O#I+PzG$?mfWJyZg;&{Cy&cbP;H7zt)L+hzInTeh8~nd5dOV3TK%XZ;=BT=! z%~7%uL)`lCSa8;;1QwYqI0UIA?2VrV?Ed}f(s(4t^WQoO=wPGEgaa9_)m?CKHOmc9Zxu1W}PDU za&yP3GYzJBFK|e9ibkB43`|Z!LZU8oC7_hh+uJ*mX6w8+xCb$@qrC-*@01#qUk4g{KSn+V>)l(W}m6S_R6uen_+|P!@Iu#V$U|F7^`DV zICkurshGhkmd%!}SMeFZjOq|3hhS)0DxegEy}mu0i>TJx zWQ}v;rUC1#611#|7NS{fnip*pNw2~f>*w^@bukY~3ZAxU26glqjoiqG!b&mWUWf1c zXvqNk)nI7oprCK-NRL-aoH0z`rQ<#yd%SVW%$1QNIOsadJO@<*C!3&-K##)RWPpuU zca8K+;f;5hL<1MO7~?^CEo@ot&KdANoL1v@IfXl>vpvJPAix^aZBpa>4 z6jI`Aiy{$Y2(++uH>W*;X`wM^H=M8x@Zt>jiFU-RnkXaa_$r3qaB6}0WLDz`Q#G#GWLL8jFj{|DH+U8QcTOGzX z=To{w1<#%CrP779CI#RB`r?-p-|X*_1Xk_II3B$*&|coP9D%r3v3HMXq6@Da$ZIK6 zbXEb5*8JRHOSC0$I`-;D{vaHK!IW8}0>8H4Wxy9s=pGv7nuW%eT{fG?uBaQXw%KI8 zrE)uvdSOdKW_>!=)WQ3~bMn5F=MK?6qO6_162MCDyZT#}XYUgwOyf=0{9osCuD3## zPbHNapjMna5FyKr8)H@r*R>p&pMjnHFC8iEi(vfNdFTYsI&ShRaN+I3j}(I=o-=>0 z%(Yuw0CyW+##D>TXZJg}=Uj`DYLpfR9UrO2KaO_HJRUh@OV2z}aM*fm3Z_@M^)nzX zxc9zNj*MZOcu;V0@!;@3U4?cW)Lz6C?nVxsa&A;YqSyDf`foMC@GB@fGmo<}sInS{ zs=AQmo?@1TdGj5EeDe>jZ+!aWe4`|yM$)cJSm^Q zovjl3Ea@f;gPt6yDr57-RDI1t{cP`?<_7io`F(9h871xFPnzhMq%t1HXS=<;qJIO2 zjq)ZGSBUmJnymCFpe0ltB0=mQe?8q3VLd)~!yqqKyUc%!3BiMvSbqN38yQp{en2rM z-^nQqKgd&*YXgJh%wp92rzPNB*MB#EM$pKk3|+jGLDk%_9H$Xg3hz5a(!fk351Rz~ zjL+3s$TT)fdFfB_<>XkSEn7{Dm2sESt<~eC9=IM2!}pMeuXk=~Lmz|_NUBfs7h@PF zZ3OJtwg1wzHsaF`vNNt}sYtsH*wbwTJ9!6JXHgFZbu$|bm9Q+w~hKC{;|IK z6{T!`qiB}GoEs!1;ZhbM1)U++*%x^>Xkwwq!-RhcK?4XnM`Qnv=8p)(^XFK!nsmIX zp*(q(XmE(c<#J_dVZf=~u~n&LQH_8(4C9|0p92>nyY2S3ODH9hDFTj~(WfM=Ne!l(feDxsP8cLs_zlhq=cZ;y%!WsP>|$<~a$ zd^aAWq!bMlcUs#7=G&Qre09y@c8GA8@w`jpYUh^R3~HcYDECiEOVo;ZtUEp1u9iV9 z^Ba`6-Cj}14mUUFWwZ!PXYf~e6SwoZdXK=P;Xjd>%+lGMdhb^>8lnTOfk z&QtvvTh{;4H(uTue=Hnq+%rY)_1*YTka;L2M})+vLeD({mr`HDl4uJFa2%hbkkqhQ zR4Z*0%) zRU!|*TNx+u=;MyEYP>2Wf-!4(KQ~xj4mL3hdS_ZM9t8Cs)qvhBk?#=NXjW|i);nZc zU41g~lY&1u4O{mg6zPR+0_iP|7?wYHYl$T2Ns$4sE!8d_ZPhqV1B{(l@&2YxfnACo z;@R8k!F%NSCywr2T8K5KZEp#BHLkBP)Y7Tq)w5c-oE#{`l5W#b<@xRX1KfVKt+x5# z=?G_VTUCI4|9O^nB-Jg}1nZ$UuS^S7Z_3dncKeo0>LuPC09oCeaKE1pD8;-tJslD) aTV-t`oAh(D6nK>kIJp0adEVYrKl~4L*fo6s