diff --git a/analysis_options.yaml b/analysis_options.yaml index 02df472e..8c943b5d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -27,7 +27,7 @@ linter: always_declare_return_types: true always_put_control_body_on_new_line: true always_require_non_null_named_parameters: true - always_specify_types: false #to be changed + always_specify_types: false #decided against using it for now annotate_overrides: true avoid_bool_literals_in_conditional_expressions: true avoid_classes_with_only_static_members: true @@ -50,7 +50,7 @@ linter: avoid_types_as_parameter_names: true avoid_unnecessary_containers: true avoid_unused_constructor_parameters: true - avoid_void_async: false # to be changed + avoid_void_async: false await_only_futures: true camel_case_extensions: true camel_case_types: false # maybe to be changed @@ -127,7 +127,7 @@ linter: throw_in_finally: true tighten_type_of_initializing_formals: true type_init_formals: true - unnecessary_await_in_return: false # to be changed + unnecessary_await_in_return: true unnecessary_brace_in_string_interps: true unnecessary_const: true unnecessary_getters_setters: true diff --git a/lib/screens/nutritional_plan_screen.dart b/lib/screens/nutritional_plan_screen.dart index 68d02caa..eacf8d6a 100644 --- a/lib/screens/nutritional_plan_screen.dart +++ b/lib/screens/nutritional_plan_screen.dart @@ -34,9 +34,8 @@ enum NutritionalPlanOptions { class NutritionalPlanScreen extends StatelessWidget { static const routeName = '/nutritional-plan-detail'; - Future _loadFullPlan(BuildContext context, int planId) async { - return await Provider.of(context, listen: false) - .fetchAndSetPlanFull(planId); + Future _loadFullPlan(BuildContext context, int planId) { + return Provider.of(context, listen: false).fetchAndSetPlanFull(planId); } @override diff --git a/lib/screens/workout_plan_screen.dart b/lib/screens/workout_plan_screen.dart index 9156eaa4..c3c3d38a 100644 --- a/lib/screens/workout_plan_screen.dart +++ b/lib/screens/workout_plan_screen.dart @@ -52,8 +52,8 @@ class _WorkoutPlanScreenState extends State { }); } - Future _loadFullWorkout(BuildContext context, int planId) async { - return await Provider.of(context, listen: false) + Future _loadFullWorkout(BuildContext context, int planId) { + return Provider.of(context, listen: false) .fetchAndSetWorkoutPlanFull(planId); } diff --git a/lib/widgets/workouts/forms.dart b/lib/widgets/workouts/forms.dart index bd0f800b..4bd887e1 100644 --- a/lib/widgets/workouts/forms.dart +++ b/lib/widgets/workouts/forms.dart @@ -391,9 +391,8 @@ class _SetFormWidgetState extends State { errorMaxLines: 2, ), ), - suggestionsCallback: (pattern) async { - return await Provider.of(context, listen: false) - .searchExercise( + suggestionsCallback: (pattern) { + return Provider.of(context, listen: false).searchExercise( pattern, Localizations.localeOf(context).languageCode, ); diff --git a/test/measurements/measurement_provider_test.dart b/test/measurements/measurement_provider_test.dart index ff9950fa..f7bf44d0 100644 --- a/test/measurements/measurement_provider_test.dart +++ b/test/measurements/measurement_provider_test.dart @@ -235,8 +235,7 @@ void main() { test('should throw a NoSuchEntryException if no category is found', () { // act & assert - expect(() async => await measurementProvider.deleteCategory(83), - throwsA(isA())); + expect(() => measurementProvider.deleteCategory(83), throwsA(isA())); }); test( @@ -246,7 +245,7 @@ void main() { when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}')); // act & assert - expect(() async => await measurementProvider.deleteCategory(tCategoryId), + expect(() async => measurementProvider.deleteCategory(tCategoryId), throwsA(isA())); expect(measurementProvider.categories, tMeasurementCategories); }); @@ -300,7 +299,7 @@ void main() { // act & assert expect( - () async => await measurementProvider.editCategory( + () => measurementProvider.editCategory( tCategoryId, tCategoryEditedName, tCategoryEditedUnit), throwsA(isA())); expect(measurementProvider.categories, tMeasurementCategories); @@ -402,7 +401,7 @@ void main() { .thenAnswer((realInvocation) => Future.value(measurementEntryMapWrongCategory)); // act & assert - expect(() async => await measurementProvider.addEntry(tMeasurementEntryWrongCategory), + expect(() => measurementProvider.addEntry(tMeasurementEntryWrongCategory), throwsA(isA())); }); }); @@ -440,7 +439,7 @@ void main() { test("should throw a NoSuchEntryException if the category isn't found", () { // act & assert - expect(() async => await measurementProvider.deleteEntry(tEntryId, 83), + expect(() async => measurementProvider.deleteEntry(tEntryId, 83), throwsA(isA())); }); @@ -448,7 +447,7 @@ void main() { "should throw a NoSuchEntryException if the entry in the categories entries List isn't found", () { // act & assert - expect(() async => await measurementProvider.deleteEntry(83, tCategoryId), + expect(() => measurementProvider.deleteEntry(83, tCategoryId), throwsA(isA())); }); @@ -486,7 +485,7 @@ void main() { when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}')); // act & assert - expect(() async => await measurementProvider.deleteEntry(tEntryId, tCategoryId), + expect(() async => measurementProvider.deleteEntry(tEntryId, tCategoryId), throwsA(isA())); expect(measurementProvider.categories, tMeasurementCategories); }); @@ -549,7 +548,7 @@ void main() { test("should throw a NoSuchEntryException if category doesn't exist", () { // act & assert expect( - () async => await measurementProvider.editEntry( + () => measurementProvider.editEntry( tEntryId, 83, tEntryEditedValue, @@ -562,7 +561,7 @@ void main() { test("should throw a NoSuchEntryException if entry doesn't exist", () { // act & assert expect( - () async => await measurementProvider.editEntry( + () => measurementProvider.editEntry( 83, tCategoryId, tEntryEditedValue,