-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add lint 'discarded_futures'. #4659
Conversation
packages/devtools_app/test/shared/service_extension_widgets_test.dart
Outdated
Show resolved
Hide resolved
when(mockClassObject.requestRetainingPath()).thenAnswer((_) async { | ||
retainingPathNotifier.value = testRetainingPath; | ||
}); | ||
|
||
when(mockClassObject.inboundReferences).thenReturn(inboundRefsNotifier); | ||
|
||
// Intebtionally unwaited. | ||
// ignore: discarded_futures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way we can turn this lint off for the test/ directory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I did not find how to exclude just one lint for a directory.
- I think code reader will benefit from seeing that a future is dropped.
@@ -166,7 +166,8 @@ class ReleaseNotes extends AnimatedWidget { | |||
: Expanded( | |||
child: Markdown( | |||
data: markdownData!, | |||
onTapLink: (_, href, __) => launchUrl(href!, context), | |||
onTapLink: (_, href, __) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onTapLink: (_, href, __) => | |
onTapLink: (_, href, __) async => | |
launchUrl(href!, context), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like the fixes to go to separate PRs. They may affect functionality and tests. And I do not want this massive PR to be held by this and thus become victim of error-prone merges.
Created bug: #4668
@@ -158,7 +160,8 @@ class _ConnectDialogState extends State<ConnectDialog> | |||
SizedBox( | |||
width: scaleByFontFactor(350.0), | |||
child: TextField( | |||
onSubmitted: actionInProgress ? null : (str) => _connect(), | |||
onSubmitted: | |||
actionInProgress ? null : (str) => unawaited(_connect()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actionInProgress ? null : (str) => unawaited(_connect()), | |
actionInProgress ? null : (str) async => _connect(), |
@@ -265,7 +268,7 @@ class ImportFileInstructions extends StatelessWidget { | |||
), | |||
const SizedBox(height: defaultSpacing), | |||
ElevatedButton( | |||
onPressed: () => _importFile(context), | |||
onPressed: () => unawaited(_importFile(context)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onPressed: () => unawaited(_importFile(context)), | |
onPressed: () async => _importFile(context), |
@@ -101,7 +103,7 @@ class _CallStackState extends State<CallStack> | |||
final result = Material( | |||
color: selected ? theme.colorScheme.selectedRowColor : null, | |||
child: InkWell( | |||
onTap: () => _onStackFrameSelected(frame), | |||
onTap: () => unawaited(_onStackFrameSelected(frame)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onTap: () => unawaited(_onStackFrameSelected(frame)), | |
onTap: () async => _onStackFrameSelected(frame), |
@@ -220,7 +222,8 @@ class VariableSelectionControls extends MaterialTextSelectionControls { | |||
clipboardStatus: clipboardStatus!, | |||
handleCut: canCut(delegate) ? () => handleCut(delegate) : null, | |||
handleCopy: canCopy(delegate) ? () => handleCopy(delegate) : null, | |||
handlePaste: canPaste(delegate) ? () => handlePaste(delegate) : null, | |||
handlePaste: | |||
canPaste(delegate) ? () => unawaited(handlePaste(delegate)) : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
canPaste(delegate) ? () => unawaited(handlePaste(delegate)) : null, | |
canPaste(delegate) ? () => unawaited(handlePaste(delegate)) : null, |
@@ -121,7 +121,7 @@ final enumValueInstance = AsyncValue.data( | |||
); | |||
|
|||
void main() { | |||
setUpAll(() => loadFonts()); | |||
setUpAll(() async => await loadFonts()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setUpAll(() async => await loadFonts()); | |
setUpAll(() async => loadFonts()); |
@@ -30,6 +30,9 @@ void main() { | |||
|
|||
setUp(() { | |||
reloads = 0; | |||
|
|||
// Intebtionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Intebtionally unwaited. | |
// Intentionally unwaited. |
y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also make the setup closure async instead
setUp(() async {
@@ -81,6 +84,9 @@ void main() { | |||
|
|||
setUp(() { | |||
restarts = 0; | |||
|
|||
// Intebtionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Intebtionally unwaited. | |
// Intentionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same about the setup could instead be async
@@ -38,6 +38,8 @@ void main() { | |||
when(mockClassObject.reachableSize).thenReturn(null); | |||
when(mockClassObject.retainedSize).thenReturn(null); | |||
|
|||
// Intebtionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Intebtionally unwaited. | |
// Intentionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could make setup async instead
setUp(() async {
when(mockClassObject.requestRetainingPath()).thenAnswer((_) async { | ||
retainingPathNotifier.value = testRetainingPath; | ||
}); | ||
|
||
when(mockClassObject.inboundReferences).thenReturn(inboundRefsNotifier); | ||
|
||
// Intebtionally unwaited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Intebtionally unwaited. | |
// Intentionally unwaited. |
No description provided.