Skip to content

Commit a589d87

Browse files
committed
dcm fix --only-rules=avoid-redundant-async
1 parent dfd18d1 commit a589d87

13 files changed

+33
-35
lines changed

lib/screens/measurement_categories_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MeasurementCategoriesScreen extends StatelessWidget {
3434
appBar: AppBar(title: Text(AppLocalizations.of(context).measurements)),
3535
floatingActionButton: FloatingActionButton(
3636
child: const Icon(Icons.add, color: Colors.white),
37-
onPressed: () async {
37+
onPressed: () {
3838
Navigator.pushNamed(
3939
context,
4040
FormScreen.routeName,

lib/screens/measurement_entries_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class MeasurementEntriesScreen extends StatelessWidget {
122122
),
123123
floatingActionButton: FloatingActionButton(
124124
child: const Icon(Icons.add, color: Colors.white),
125-
onPressed: () async {
125+
onPressed: () {
126126
Navigator.pushNamed(
127127
context,
128128
FormScreen.routeName,

lib/widgets/dashboard/widgets.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class _DashboardWeightWidgetState extends State<DashboardWeightWidget> {
209209
),
210210
IconButton(
211211
icon: const Icon(Icons.add),
212-
onPressed: () async {
212+
onPressed: () {
213213
Navigator.pushNamed(
214214
context,
215215
FormScreen.routeName,
@@ -526,7 +526,7 @@ class NothingFound extends StatelessWidget {
526526
IconButton(
527527
iconSize: 30,
528528
icon: const Icon(Icons.add_box, color: wgerPrimaryButtonColor),
529-
onPressed: () async {
529+
onPressed: () {
530530
Navigator.pushNamed(
531531
context,
532532
FormScreen.routeName,

test/exercises/exercise_provider_load_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ void main() {
4141
await ServiceLocator().configure();
4242
});
4343

44-
setUp(() async {
44+
setUp(() {
4545
WidgetsFlutterBinding.ensureInitialized();
4646
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
4747

test/exercises/exercise_provider_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void main() {
8484
fixture('exercises/exercisebaseinfo_response.json'),
8585
);
8686

87-
setUpAll(() async {
87+
setUpAll(() {
8888
// Needs to be configured here, setUp runs on every test, setUpAll only once
8989
//await ServiceLocator().configure();
9090
});

test/exercises/model_exercise_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void main() {
1212
);
1313

1414
group('Model tests', () {
15-
test('test getExercise', () async {
15+
test('test getExercise', () {
1616
// arrange and act
1717
final base = getTestExercises()[1];
1818

test/measurements/measurement_provider_test.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ void main() {
240240

241241
test(
242242
'should re-add the "removed" MeasurementCategory and relay the exception on WgerHttpException',
243-
() async {
243+
() {
244244
// arrange
245245
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
246246

247247
// act & assert
248-
expect(() async => measurementProvider.deleteCategory(tCategoryId),
249-
throwsA(isA<WgerHttpException>()));
248+
expect(
249+
() => measurementProvider.deleteCategory(tCategoryId), throwsA(isA<WgerHttpException>()));
250250
expect(measurementProvider.categories, tMeasurementCategories);
251251
});
252252
});
@@ -279,9 +279,7 @@ void main() {
279279

280280
test("should throw a NoSuchEntryException if category doesn't exist", () {
281281
// act & assert
282-
expect(
283-
() async =>
284-
measurementProvider.editCategory(83, tCategoryEditedName, tCategoryEditedUnit),
282+
expect(() => measurementProvider.editCategory(83, tCategoryEditedName, tCategoryEditedUnit),
285283
throwsA(isA<NoSuchEntryException>()));
286284
});
287285

@@ -439,7 +437,7 @@ void main() {
439437

440438
test("should throw a NoSuchEntryException if the category isn't found", () {
441439
// act & assert
442-
expect(() async => measurementProvider.deleteEntry(tEntryId, 83),
440+
expect(() => measurementProvider.deleteEntry(tEntryId, 83),
443441
throwsA(isA<NoSuchEntryException>()));
444442
});
445443

@@ -461,7 +459,7 @@ void main() {
461459

462460
test(
463461
'should re-add the "removed" MeasurementEntry and throw a WgerHttpException if the api call fails',
464-
() async {
462+
() {
465463
// arrange
466464
final List<MeasurementCategory> tMeasurementCategories = [
467465
MeasurementCategory(id: 1, name: 'Strength', unit: 'kN', entries: [
@@ -485,7 +483,7 @@ void main() {
485483
when(mockWgerBaseProvider.deleteRequest(any, any)).thenThrow(WgerHttpException('{}'));
486484

487485
// act & assert
488-
expect(() async => measurementProvider.deleteEntry(tEntryId, tCategoryId),
486+
expect(() => measurementProvider.deleteEntry(tEntryId, tCategoryId),
489487
throwsA(isA<WgerHttpException>()));
490488
expect(measurementProvider.categories, tMeasurementCategories);
491489
});

test/other/base_provider_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import 'base_provider_test.mocks.dart';
3030
@GenerateMocks([http.Client])
3131
void main() {
3232
group('test base provider', () {
33-
test('Test the makeUrl helper', () async {
33+
test('Test the makeUrl helper', () {
3434
final WgerBaseProvider provider = WgerBaseProvider(testAuthProvider);
3535

3636
expect(
@@ -63,7 +63,7 @@ void main() {
6363
);
6464
});
6565

66-
test('Test the makeUrl helper with sub url', () async {
66+
test('Test the makeUrl helper with sub url', () {
6767
// Trailing slash is removed when saving the server URL
6868
testAuthProvider.serverUrl = 'https://example.com/wger-url';
6969
final WgerBaseProvider provider = WgerBaseProvider(testAuthProvider);

test/weight/weight_model_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ import 'package:wger/models/body_weight/weight_entry.dart';
2121

2222
void main() {
2323
group('fetchPost', () {
24-
test('Test that the weight entries are correctly converted to json', () async {
24+
test('Test that the weight entries are correctly converted to json', () {
2525
WeightEntry weightEntry = WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
2626
expect(weightEntry.toJson(), {'id': 1, 'weight': '80', 'date': '2020-12-31'});
2727

2828
weightEntry = WeightEntry(id: 2, weight: 70.2, date: DateTime(2020, 12, 01));
2929
expect(weightEntry.toJson(), {'id': 2, 'weight': '70.2', 'date': '2020-12-01'});
3030
});
3131

32-
test('Test that the weight entries are correctly converted from json', () async {
32+
test('Test that the weight entries are correctly converted from json', () {
3333
final WeightEntry weightEntryObj =
3434
WeightEntry(id: 1, weight: 80, date: DateTime(2020, 12, 31));
3535
final WeightEntry weightEntry = WeightEntry.fromJson({

test/workout/plate_calculator_test.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import 'package:wger/helpers/gym_mode.dart';
2222

2323
void main() {
2424
group('Test the plate calculator', () {
25-
test('Regular weights', () async {
25+
test('Regular weights', () {
2626
expect(plateCalculator(40, BAR_WEIGHT, AVAILABLE_PLATES), [10]);
2727
expect(plateCalculator(100, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 10]);
2828
expect(plateCalculator(102.5, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 10, 1.25]);
@@ -31,7 +31,7 @@ void main() {
3131
expect(plateCalculator(85, BAR_WEIGHT, AVAILABLE_PLATES), [15, 15, 2.5]);
3232
});
3333

34-
test('Exceptions', () async {
34+
test('Exceptions', () {
3535
expect(
3636
plateCalculator(10, BAR_WEIGHT, AVAILABLE_PLATES),
3737
[],
@@ -47,7 +47,7 @@ void main() {
4747
});
4848

4949
group('Test the plate calculator group', () {
50-
test('Test groups', () async {
50+
test('Test groups', () {
5151
expect(groupPlates([15, 15, 15, 10, 10, 5]), {15: 3, 10: 2, 5: 1});
5252
expect(groupPlates([15, 10, 5, 1.25]), {15: 1, 10: 1, 5: 1, 1.25: 1});
5353
expect(groupPlates([10, 10, 10, 10, 10, 10, 10]), {10: 7});

0 commit comments

Comments
 (0)