mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-18 00:17:48 +01:00
unnecessary_await_in_return
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -34,9 +34,8 @@ enum NutritionalPlanOptions {
|
||||
class NutritionalPlanScreen extends StatelessWidget {
|
||||
static const routeName = '/nutritional-plan-detail';
|
||||
|
||||
Future<NutritionalPlan> _loadFullPlan(BuildContext context, int planId) async {
|
||||
return await Provider.of<NutritionPlansProvider>(context, listen: false)
|
||||
.fetchAndSetPlanFull(planId);
|
||||
Future<NutritionalPlan> _loadFullPlan(BuildContext context, int planId) {
|
||||
return Provider.of<NutritionPlansProvider>(context, listen: false).fetchAndSetPlanFull(planId);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -52,8 +52,8 @@ class _WorkoutPlanScreenState extends State<WorkoutPlanScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
Future<WorkoutPlan> _loadFullWorkout(BuildContext context, int planId) async {
|
||||
return await Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
Future<WorkoutPlan> _loadFullWorkout(BuildContext context, int planId) {
|
||||
return Provider.of<WorkoutPlansProvider>(context, listen: false)
|
||||
.fetchAndSetWorkoutPlanFull(planId);
|
||||
}
|
||||
|
||||
|
||||
@@ -391,9 +391,8 @@ class _SetFormWidgetState extends State<SetFormWidget> {
|
||||
errorMaxLines: 2,
|
||||
),
|
||||
),
|
||||
suggestionsCallback: (pattern) async {
|
||||
return await Provider.of<ExercisesProvider>(context, listen: false)
|
||||
.searchExercise(
|
||||
suggestionsCallback: (pattern) {
|
||||
return Provider.of<ExercisesProvider>(context, listen: false).searchExercise(
|
||||
pattern,
|
||||
Localizations.localeOf(context).languageCode,
|
||||
);
|
||||
|
||||
@@ -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<NoSuchEntryException>()));
|
||||
expect(() => measurementProvider.deleteCategory(83), throwsA(isA<NoSuchEntryException>()));
|
||||
});
|
||||
|
||||
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<WgerHttpException>()));
|
||||
expect(measurementProvider.categories, tMeasurementCategories);
|
||||
});
|
||||
@@ -300,7 +299,7 @@ void main() {
|
||||
|
||||
// act & assert
|
||||
expect(
|
||||
() async => await measurementProvider.editCategory(
|
||||
() => measurementProvider.editCategory(
|
||||
tCategoryId, tCategoryEditedName, tCategoryEditedUnit),
|
||||
throwsA(isA<WgerHttpException>()));
|
||||
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<NoSuchEntryException>()));
|
||||
});
|
||||
});
|
||||
@@ -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<NoSuchEntryException>()));
|
||||
});
|
||||
|
||||
@@ -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<NoSuchEntryException>()));
|
||||
});
|
||||
|
||||
@@ -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<WgerHttpException>()));
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user