@@ -66,7 +66,7 @@ class DaemonStdioHelper {
66
66
/// Awaits for a daemon event with the given [methodKey] .
67
67
Future <DaemonEvent > awaitForDaemonEvent (
68
68
String methodKey, {
69
- Duration timeout = const Duration (seconds : 1 ) ,
69
+ Duration timeout = _defaultTimeout ,
70
70
Matcher ? withParamsThat,
71
71
}) async {
72
72
var wrappedMatcher = isA <DaemonEvent >()
@@ -91,7 +91,7 @@ class DaemonStdioHelper {
91
91
/// Awaits for a daemon message that matches the given [messageMatcher] .
92
92
Future <DaemonMessage > awaitForDaemonMessage (
93
93
Matcher messageMatcher, {
94
- Duration timeout = const Duration (seconds : 1 ) ,
94
+ Duration timeout = _defaultTimeout ,
95
95
}) async {
96
96
final wrappedMatcher = _MatchMessageToStdoutLine (messageMatcher);
97
97
@@ -106,7 +106,7 @@ class DaemonStdioHelper {
106
106
/// Awaits for a string message that matches the given [messageMatcher] .
107
107
Future <String > awaitForStringMessage (
108
108
Matcher messageMatcher, {
109
- Duration timeout = const Duration (seconds : 1 ) ,
109
+ Duration timeout = _defaultTimeout ,
110
110
}) async {
111
111
messageMatchers.add (messageMatcher);
112
112
@@ -116,15 +116,15 @@ class DaemonStdioHelper {
116
116
}).firstOrNull;
117
117
118
118
if (existingItem case (final int itemIndex, final String itemValue)) {
119
- // if there is a matching message in the cache,
119
+ // If there is a matching message in the cache,
120
120
// remove all the previous messages from the cache and
121
121
// return the matching message.
122
122
_pastMessagesCache = _pastMessagesCache.skip (itemIndex + 1 ).toList ();
123
123
_clean (messageMatcher, null );
124
124
return itemValue;
125
125
}
126
126
127
- // if there is no matching message in the cache,
127
+ // If there is no matching message in the cache,
128
128
// create a completer and wait for the message to be received
129
129
// or for the timeout to expire.
130
130
@@ -157,7 +157,7 @@ class DaemonStdioHelper {
157
157
/// [TimeoutException] if the timeout expires.
158
158
Future <DaemonResponse > sendDaemonRequest (
159
159
DaemonRequest request, {
160
- Duration timeout = const Duration (seconds : 10 ) ,
160
+ Duration timeout = _defaultTimeout ,
161
161
}) async {
162
162
final json = jsonEncode (request.toJson ());
163
163
@@ -183,7 +183,7 @@ class DaemonStdioHelper {
183
183
/// [TimeoutException] if the timeout expires.
184
184
Future <(DaemonResponse , DaemonResponse )> sendStaggeredDaemonRequest (
185
185
(DaemonRequest , DaemonRequest ) requests, {
186
- Duration timeout = const Duration (seconds : 10 ) ,
186
+ Duration timeout = _defaultTimeout ,
187
187
}) async {
188
188
final request1 = requests.$1;
189
189
final request2 = requests.$2;
@@ -230,6 +230,8 @@ class DaemonStdioHelper {
230
230
void dispose () {
231
231
subscription.cancel ();
232
232
}
233
+
234
+ static const _defaultTimeout = Duration (seconds: 10 );
233
235
}
234
236
235
237
/// A matcher that matches a [DaemonMessage] to a daemon stdout line.
0 commit comments