Skip to content

Commit e431b80

Browse files
Merge pull request #1915 from nextcloud/refactor/ignores
2 parents bff3a35 + 9a09c30 commit e431b80

File tree

14 files changed

+73
-102
lines changed

14 files changed

+73
-102
lines changed

packages/neon/neon_notes/lib/src/blocs/note.dart

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ class _NotesNoteBloc extends InteractiveBloc implements NotesNoteBloc {
5353
etag = note.etag;
5454
}
5555

56-
// ignore: avoid_void_async
57-
void wrapNoteAction(Future<DynamiteResponse<notes.Note, dynamic>> Function(String etag) call) async {
56+
Future<void> wrapNoteAction(Future<DynamiteResponse<notes.Note, dynamic>> Function(String etag) call) async {
5857
await updateQueue.add(() async {
5958
try {
6059
final response = await call(etag);
@@ -99,8 +98,8 @@ class _NotesNoteBloc extends InteractiveBloc implements NotesNoteBloc {
9998
Future<void> refresh() async {}
10099

101100
@override
102-
void updateCategory(String category) {
103-
wrapNoteAction(
101+
Future<void> updateCategory(String category) async {
102+
await wrapNoteAction(
104103
(etag) async => account.client.notes.updateNote(
105104
id: id,
106105
category: category,
@@ -110,8 +109,8 @@ class _NotesNoteBloc extends InteractiveBloc implements NotesNoteBloc {
110109
}
111110

112111
@override
113-
void updateContent(String content) {
114-
wrapNoteAction(
112+
Future<void> updateContent(String content) async {
113+
await wrapNoteAction(
115114
(etag) async => account.client.notes.updateNote(
116115
id: id,
117116
content: content,
@@ -121,8 +120,8 @@ class _NotesNoteBloc extends InteractiveBloc implements NotesNoteBloc {
121120
}
122121

123122
@override
124-
void updateTitle(String title) {
125-
wrapNoteAction(
123+
Future<void> updateTitle(String title) async {
124+
await wrapNoteAction(
126125
(etag) async => account.client.notes.updateNote(
127126
id: id,
128127
title: title,

packages/neon/neon_talk/lib/src/dialogs/create_room.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ class _TalkCreateRoomDialogState extends State<TalkCreateRoomDialog> {
149149
onFieldSubmitted: (_) {
150150
submit();
151151
},
152-
// ignore: avoid_types_on_closure_parameters
153152
resultBuilder: buildResult,
154153
onSelected: (result) {
155154
setState(() {

packages/neon/neon_talk/test/create_room_dialog_test.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// ignore_for_file: prefer_asserts_with_message
21
import 'dart:convert';
32

43
import 'package:built_collection/built_collection.dart';

packages/neon_framework/lib/src/app.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ class NeonApp extends StatefulWidget {
5151
State<NeonApp> createState() => _NeonAppState();
5252
}
5353

54-
// ignore: prefer_mixin
5554
class _NeonAppState extends State<NeonApp> with WidgetsBindingObserver, WindowListener {
5655
final _appRegex = RegExp(r'^app_([a-z]+)$', multiLine: true);
5756
final _navigatorKey = GlobalKey<NavigatorState>();

packages/neon_framework/lib/src/storage/sqlite_persistence.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// ignore_for_file: cascade_invocations
2-
31
import 'dart:async';
42
import 'dart:convert';
53

@@ -159,8 +157,9 @@ WHERE prefix = ?
159157
fromSystem[key] = _decode(value) as Object;
160158
}
161159

162-
cache.clear();
163-
cache.addAll(fromSystem);
160+
cache
161+
..clear()
162+
..addAll(fromSystem);
164163
} on DatabaseException catch (error) {
165164
_log.warning(
166165
'Error reloading the SQLite persistence.',

packages/neon_framework/lib/src/theme/color_scheme.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ class NeonColorScheme {
1010
this.primary = NcColors.primary,
1111
});
1212

13+
/// Linearly interpolate between two [NeonColorScheme]s.
14+
///
15+
/// {@macro dart.ui.shadow.lerp}
16+
factory NeonColorScheme.lerp(NeonColorScheme a, NeonColorScheme b, double t) {
17+
if (identical(a, b)) {
18+
return a;
19+
}
20+
return NeonColorScheme(
21+
primary: Color.lerp(a.primary, b.primary, t)!,
22+
);
23+
}
24+
1325
/// Primary color used throughout the app.
1426
///
1527
/// See [ColorScheme.primary]
@@ -28,19 +40,6 @@ class NeonColorScheme {
2840
/// The data from the closest [NeonColorScheme] instance given the build context.
2941
static NeonColorScheme of(BuildContext context) => Theme.of(context).extension<NeonTheme>()!.colorScheme;
3042

31-
/// Linearly interpolate between two [NeonColorScheme]s.
32-
///
33-
/// {@macro dart.ui.shadow.lerp}
34-
// ignore: prefer_constructors_over_static_methods
35-
static NeonColorScheme lerp(NeonColorScheme a, NeonColorScheme b, double t) {
36-
if (identical(a, b)) {
37-
return a;
38-
}
39-
return NeonColorScheme(
40-
primary: Color.lerp(a.primary, b.primary, t)!,
41-
);
42-
}
43-
4443
@override
4544
int get hashCode => Object.hashAll([
4645
primary,

packages/neon_framework/lib/src/theme/dialog.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@ class NeonDialogTheme {
1818
this.padding = const EdgeInsets.all(24),
1919
});
2020

21+
/// Linearly interpolate between two [NeonDialogTheme]s.
22+
///
23+
/// {@macro dart.ui.shadow.lerp}
24+
factory NeonDialogTheme.lerp(NeonDialogTheme a, NeonDialogTheme b, double t) {
25+
if (identical(a, b)) {
26+
return a;
27+
}
28+
return NeonDialogTheme(
29+
constraints: BoxConstraints.lerp(a.constraints, b.constraints, t)!,
30+
padding: EdgeInsets.lerp(a.padding, b.padding, t)!,
31+
);
32+
}
33+
2134
/// Used to configure the [BoxConstraints] for the [NeonDialog] widget.
2235
///
2336
/// This value should also be used on [Dialog.fullscreen] and other similar pages.
@@ -44,20 +57,6 @@ class NeonDialogTheme {
4457
/// The data from the closest [NeonDialogTheme] instance given the build context.
4558
static NeonDialogTheme of(BuildContext context) => Theme.of(context).extension<NeonTheme>()!.dialogTheme;
4659

47-
/// Linearly interpolate between two [NeonDialogTheme]s.
48-
///
49-
/// {@macro dart.ui.shadow.lerp}
50-
// ignore: prefer_constructors_over_static_methods
51-
static NeonDialogTheme lerp(NeonDialogTheme a, NeonDialogTheme b, double t) {
52-
if (identical(a, b)) {
53-
return a;
54-
}
55-
return NeonDialogTheme(
56-
constraints: BoxConstraints.lerp(a.constraints, b.constraints, t)!,
57-
padding: EdgeInsets.lerp(a.padding, b.padding, t)!,
58-
);
59-
}
60-
6160
@override
6261
int get hashCode => Object.hashAll([
6362
constraints,

packages/neon_framework/test/option_test.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// ignore_for_file: discarded_futures, inference_failure_on_instance_creation
1+
// ignore_for_file: inference_failure_on_instance_creation
22

33
import 'package:flutter/foundation.dart';
44
import 'package:flutter_test/flutter_test.dart';
@@ -37,7 +37,9 @@ void main() {
3737
late SelectOption<SelectValues> option;
3838

3939
setUp(() {
40+
// ignore: discarded_futures
4041
when(() => storage.setString(key.value, any())).thenAnswer((_) async => true);
42+
// ignore: discarded_futures
4143
when(() => storage.remove(key.value)).thenAnswer((_) async => true);
4244

4345
option = SelectOption<SelectValues>(
@@ -97,6 +99,7 @@ void main() {
9799
..value = SelectValues.third;
98100

99101
verify(callback.call).called(1);
102+
// ignore: discarded_futures
100103
verify(() => storage.setString(key.value, 'SelectValues.third')).called(1);
101104
expect(option.value, SelectValues.third, reason: 'Should update the value.');
102105

@@ -166,6 +169,7 @@ void main() {
166169
option.reset();
167170

168171
verify(callback.call).called(1);
172+
// ignore: discarded_futures
169173
verify(() => storage.remove(key.value)).called(1);
170174
expect(option.value, option.defaultValue, reason: 'Should reset the value.');
171175
});
@@ -216,7 +220,9 @@ void main() {
216220
late ToggleOption option;
217221

218222
setUp(() {
223+
// ignore: discarded_futures
219224
when(() => storage.setBool(key.value, any())).thenAnswer((_) async => true);
225+
// ignore: discarded_futures
220226
when(() => storage.remove(key.value)).thenAnswer((_) async => true);
221227

222228
option = ToggleOption(
@@ -273,6 +279,7 @@ void main() {
273279
..value = false;
274280

275281
verify(callback.call).called(1);
282+
// ignore: discarded_futures
276283
verify(() => storage.setBool(key.value, false)).called(1);
277284
expect(option.value, false, reason: 'Should update the value.');
278285

@@ -307,14 +314,14 @@ void main() {
307314
option.reset();
308315

309316
verify(callback.call).called(1);
317+
// ignore: discarded_futures
310318
verify(() => storage.remove(key.value)).called(1);
311319
expect(option.value, option.defaultValue, reason: 'Should reset the value.');
312320
});
313321

314322
test('Deserialize', () {
315323
expect(option.value, true);
316324

317-
// ignore: cascade_invocations
318325
option.load(false);
319326

320327
expect(option.value, false);

packages/neon_framework/test/persistence_test.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// ignore_for_file: unnecessary_lambdas, inference_failure_on_instance_creation, strict_raw_type
2-
// ignore_for_file: inference_failure_on_collection_literal
1+
// ignore_for_file: inference_failure_on_instance_creation, strict_raw_type, inference_failure_on_collection_literal
32

43
import 'package:built_collection/built_collection.dart';
54
import 'package:cookie_store/cookie_store.dart';

0 commit comments

Comments
 (0)