Adopt package:dart_flutter_team_lints and fix lints (#2799)
* adopted new lint rules
* fix casting error
diff --git a/dwds/analysis_options.yaml b/dwds/analysis_options.yaml
index 25d27d9..373ad82 100644
--- a/dwds/analysis_options.yaml
+++ b/dwds/analysis_options.yaml
@@ -1,12 +1,11 @@
-include: package:analysis_config/analysis_options.yaml
+include: package:dart_flutter_team_lints/analysis_options.yaml
analyzer:
exclude:
# Ignore generated files
- "lib/data/*"
- # Ignore debug extension builds
- - "debug_extension/compiled/*"
linter:
rules:
- - always_use_package_imports
+ always_use_package_imports: true
+ prefer_relative_imports: false
diff --git a/dwds/lib/config.dart b/dwds/lib/config.dart
index aaf1193..ddd51b4 100644
--- a/dwds/lib/config.dart
+++ b/dwds/lib/config.dart
@@ -5,7 +5,7 @@
export 'src/config/tool_configuration.dart'
show
AppMetadata,
- ToolConfiguration,
- UrlEncoder,
+ DebugSettings,
DevToolsLauncher,
- DebugSettings;
+ ToolConfiguration,
+ UrlEncoder;
diff --git a/dwds/lib/dart_web_debug_service.dart b/dwds/lib/dart_web_debug_service.dart
index c921953..a29e7df 100644
--- a/dwds/lib/dart_web_debug_service.dart
+++ b/dwds/lib/dart_web_debug_service.dart
@@ -145,8 +145,9 @@
debugSettings.expressionCompiler,
injected,
DartDevelopmentServiceConfiguration(
- // This technically isn't correct, but DartDevelopmentServiceConfiguration.enable
- // is true by default, so this won't break unmigrated tools.
+ // This technically isn't correct, but
+ // DartDevelopmentServiceConfiguration.enable is true by default, so
+ // this won't break unmigrated tools.
// ignore: deprecated_member_use_from_same_package
enable: debugSettings.spawnDds && debugSettings.ddsConfiguration.enable,
// ignore: deprecated_member_use_from_same_package
diff --git a/dwds/lib/dwds.dart b/dwds/lib/dwds.dart
index 76a1191..2e178b5 100644
--- a/dwds/lib/dwds.dart
+++ b/dwds/lib/dwds.dart
@@ -2,19 +2,19 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-export 'dart_web_debug_service.dart' show Dwds, ConnectionProvider;
+export 'dart_web_debug_service.dart' show ConnectionProvider, Dwds;
export 'src/config/tool_configuration.dart'
show
AppMetadata,
- UrlEncoder,
DartDevelopmentServiceConfiguration,
- DevToolsLauncher,
DebugSettings,
- ToolConfiguration;
+ DevToolsLauncher,
+ ToolConfiguration,
+ UrlEncoder;
export 'src/connections/app_connection.dart' show AppConnection;
export 'src/connections/debug_connection.dart' show DebugConnection;
export 'src/debugging/metadata/provider.dart'
- show MetadataProvider, AbsoluteImportUriException;
+ show AbsoluteImportUriException, MetadataProvider;
export 'src/events.dart' show DwdsEvent;
export 'src/handlers/dev_handler.dart' show AppConnectionException;
export 'src/handlers/socket_connections.dart';
@@ -30,7 +30,7 @@
FrontendServerRequireStrategyProvider;
export 'src/loaders/require.dart' show RequireStrategy;
export 'src/loaders/strategy.dart'
- show LoadStrategy, ReloadConfiguration, BuildSettings;
+ show BuildSettings, LoadStrategy, ReloadConfiguration;
export 'src/readers/asset_reader.dart' show AssetReader, PackageUriMapper;
export 'src/readers/frontend_server_asset_reader.dart'
show FrontendServerAssetReader;
@@ -40,12 +40,12 @@
show ChromeDebugException;
export 'src/services/expression_compiler.dart'
show
+ CompilerOptions,
ExpressionCompilationResult,
ExpressionCompiler,
- ModuleInfo,
- CompilerOptions;
+ ModuleInfo;
export 'src/services/expression_compiler_service.dart'
show ExpressionCompilerService;
export 'src/utilities/ddc_names.dart';
export 'src/utilities/sdk_configuration.dart'
- show SdkLayout, SdkConfiguration, SdkConfigurationProvider;
+ show SdkConfiguration, SdkConfigurationProvider, SdkLayout;
diff --git a/dwds/lib/expression_compiler.dart b/dwds/lib/expression_compiler.dart
index 6748414..d020be8 100644
--- a/dwds/lib/expression_compiler.dart
+++ b/dwds/lib/expression_compiler.dart
@@ -4,8 +4,8 @@
export 'src/services/expression_compiler.dart'
show
+ CompilerOptions,
ExpressionCompilationResult,
ExpressionCompiler,
- CompilerOptions,
ModuleFormat,
ModuleInfo;
diff --git a/dwds/lib/sdk_configuration.dart b/dwds/lib/sdk_configuration.dart
index 1135d37..b4608c7 100644
--- a/dwds/lib/sdk_configuration.dart
+++ b/dwds/lib/sdk_configuration.dart
@@ -4,7 +4,7 @@
export 'src/utilities/sdk_configuration.dart'
show
- SdkLayout,
+ DefaultSdkConfigurationProvider,
SdkConfiguration,
SdkConfigurationProvider,
- DefaultSdkConfigurationProvider;
+ SdkLayout;
diff --git a/dwds/lib/src/connections/debug_connection.dart b/dwds/lib/src/connections/debug_connection.dart
index cdf3151..9cc9e24 100644
--- a/dwds/lib/src/connections/debug_connection.dart
+++ b/dwds/lib/src/connections/debug_connection.dart
@@ -14,7 +14,7 @@
/// Protocol.
class DebugConnection {
final AppDebugServices _appDebugServices;
- final _onDoneCompleter = Completer();
+ final _onDoneCompleter = Completer<void>();
/// Null until [close] is called.
///
diff --git a/dwds/lib/src/debugging/chrome_inspector.dart b/dwds/lib/src/debugging/chrome_inspector.dart
index 61c0b00..40a6472 100644
--- a/dwds/lib/src/debugging/chrome_inspector.dart
+++ b/dwds/lib/src/debugging/chrome_inspector.dart
@@ -164,7 +164,8 @@
if (namedArgs.isNotEmpty) {
throw UnsupportedError('Named arguments are not yet supported');
}
- // We use the JS pseudo-variable 'arguments' to get the list of all arguments.
+ // We use the JS pseudo-variable 'arguments' to get the list of all
+ // arguments.
final send = globalToolConfiguration.loadStrategy.dartRuntimeDebugger
.callInstanceMethodJsExpression(methodName);
final remote = await jsCallFunctionOn(receiver, send, positionalArgs);
diff --git a/dwds/lib/src/debugging/classes.dart b/dwds/lib/src/debugging/classes.dart
index eee4fde..5003cec 100644
--- a/dwds/lib/src/debugging/classes.dart
+++ b/dwds/lib/src/debugging/classes.dart
@@ -96,17 +96,18 @@
final methodDescriptors = _mapify(classDescriptor['methods']);
methodDescriptors.forEach((name, descriptor) {
final methodId = 'methods|$classId|$name';
+ final methodDescriptor = _mapify(descriptor);
methodRefs.add(
FuncRef(
id: methodId,
name: name,
owner: classRef,
- isConst: descriptor['isConst'] as bool? ?? false,
- isStatic: descriptor['isStatic'] as bool? ?? false,
- implicit: descriptor['isImplicit'] as bool? ?? false,
- isAbstract: descriptor['isAbstract'] as bool? ?? false,
- isGetter: descriptor['isGetter'] as bool? ?? false,
- isSetter: descriptor['isSetter'] as bool? ?? false,
+ isConst: methodDescriptor['isConst'] as bool? ?? false,
+ isStatic: methodDescriptor['isStatic'] as bool? ?? false,
+ implicit: methodDescriptor['isImplicit'] as bool? ?? false,
+ isAbstract: methodDescriptor['isAbstract'] as bool? ?? false,
+ isGetter: methodDescriptor['isGetter'] as bool? ?? false,
+ isSetter: methodDescriptor['isSetter'] as bool? ?? false,
),
);
});
@@ -114,11 +115,12 @@
final fieldDescriptors = _mapify(classDescriptor['fields']);
fieldDescriptors.forEach((name, descriptor) {
+ final fieldDescriptor = _mapify(descriptor);
final classMetaData = ClassMetaData(
runtimeKind: RuntimeObjectKind.type,
classRef: classRefFor(
- descriptor['classLibraryId'],
- descriptor['className'],
+ fieldDescriptor['classLibraryId'] as String?,
+ fieldDescriptor['className'] as String?,
),
);
@@ -132,16 +134,17 @@
kind: classMetaData.kind,
classRef: classMetaData.classRef,
),
- isConst: descriptor['isConst'] as bool? ?? false,
- isFinal: descriptor['isFinal'] as bool? ?? false,
- isStatic: descriptor['isStatic'] as bool? ?? false,
+ isConst: fieldDescriptor['isConst'] as bool? ?? false,
+ isFinal: fieldDescriptor['isFinal'] as bool? ?? false,
+ isStatic: fieldDescriptor['isStatic'] as bool? ?? false,
id: createId(),
),
);
});
- final superClassLibraryId = classDescriptor['superClassLibraryId'];
- final superClassName = classDescriptor['superClassName'];
+ final superClassLibraryId =
+ classDescriptor['superClassLibraryId'] as String?;
+ final superClassName = classDescriptor['superClassName'] as String?;
final superClassRef = superClassName == null
? null
: classRefFor(superClassLibraryId, superClassName);
diff --git a/dwds/lib/src/debugging/dart_runtime_debugger.dart b/dwds/lib/src/debugging/dart_runtime_debugger.dart
index a3e24bb..b94fbcf 100644
--- a/dwds/lib/src/debugging/dart_runtime_debugger.dart
+++ b/dwds/lib/src/debugging/dart_runtime_debugger.dart
@@ -107,7 +107,8 @@
/// Generates a JS expression for retrieving Dart Developer Extension Names.
String getDartDeveloperExtensionNamesJsExpression() {
return _generateJsExpression(
- "${_loadStrategy.loadModuleSnippet}('dart_sdk').developer._extensions.keys.toList();",
+ '${_loadStrategy.loadModuleSnippet}("dart_sdk").developer._extensions'
+ '.keys.toList();',
'dartDevEmbedder.debugger.extensionNames',
);
}
@@ -180,10 +181,12 @@
return _generateJsExpression(
generateInstanceMethodJsExpression(
- '${_loadStrategy.loadModuleSnippet}("dart_sdk").dart.dsendRepl(this, "$methodName", arguments)',
+ '${_loadStrategy.loadModuleSnippet}("dart_sdk").dart'
+ '.dsendRepl(this, "$methodName", arguments)',
),
generateInstanceMethodJsExpression(
- 'dartDevEmbedder.debugger.callInstanceMethod(this, "$methodName", arguments)',
+ 'dartDevEmbedder.debugger.callInstanceMethod'
+ '(this, "$methodName", arguments)',
),
);
}
@@ -191,8 +194,10 @@
/// Generates a JS expression to invoke a Dart extension method.
String invokeExtensionJsExpression(String methodName, String encodedJson) {
return _generateJsExpression(
- "${_loadStrategy.loadModuleSnippet}('dart_sdk').developer.invokeExtension('$methodName', JSON.stringify($encodedJson));",
- "dartDevEmbedder.debugger.invokeExtension('$methodName', JSON.stringify($encodedJson));",
+ '${_loadStrategy.loadModuleSnippet}("dart_sdk").developer'
+ '.invokeExtension("$methodName", JSON.stringify($encodedJson));',
+ 'dartDevEmbedder.debugger.invokeExtension'
+ '("$methodName", JSON.stringify($encodedJson));',
);
}
@@ -209,14 +214,15 @@
})();
''';
- // `callLibraryMethod` expects an array of arguments. Chrome DevTools spreads
- // arguments individually when calling functions. This code reconstructs the
- // expected argument array.
+ // `callLibraryMethod` expects an array of arguments. Chrome DevTools
+ // spreads arguments individually when calling functions. This code
+ // reconstructs the expected argument array.
return _generateJsExpression(
findLibraryExpression,
_wrapWithBundleLoader(
'',
- 'callLibraryMethod("$libraryUri", "$methodName", Array.from(arguments))',
+ 'callLibraryMethod("$libraryUri", "$methodName", '
+ 'Array.from(arguments))',
),
);
}
diff --git a/dwds/lib/src/debugging/debugger.dart b/dwds/lib/src/debugging/debugger.dart
index 79ab77e..2a5a5e4 100644
--- a/dwds/lib/src/debugging/debugger.dart
+++ b/dwds/lib/src/debugging/debugger.dart
@@ -68,7 +68,7 @@
this._streamNotify,
this._locations,
this._skipLists,
- root,
+ String root,
) : _breakpoints = _Breakpoints(
locations: _locations,
remoteDebugger: _remoteDebugger,
@@ -347,8 +347,10 @@
/// If we do not have [Location] data for the embedded JS location, null is
/// returned.
Future<Location?> _sourceLocation(DebuggerPausedEvent e) async {
- final frame = e.params?['callFrames']?[0];
- final location = frame?['location'];
+ final frame =
+ (e.params?['callFrames'] as List<dynamic>?)?[0]
+ as Map<String, dynamic>?;
+ final location = frame?['location'] as Map<String, dynamic>?;
if (location == null) return null;
final scriptId = location['scriptId'] as String?;
@@ -369,8 +371,11 @@
/// Returns script ID for the paused event.
String? _frameScriptId(DebuggerPausedEvent e) {
- final frame = e.params?['callFrames']?[0];
- return frame?['location']?['scriptId'] as String?;
+ final frame =
+ (e.params?['callFrames'] as List<dynamic>?)?[0]
+ as Map<String, dynamic>?;
+ return (frame?['location'] as Map<String, dynamic>?)?['scriptId']
+ as String?;
}
/// The variables visible in a frame in Dart protocol [BoundVariable] form.
@@ -423,7 +428,8 @@
// void _showPausedOverlay() async {
// if (_pausedOverlayVisible) return;
// handleErrorIfPresent(await _remoteDebugger?.sendCommand('DOM.enable'));
- // handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.enable'));
+ // handleErrorIfPresent(
+ // await _remoteDebugger?.sendCommand('Overlay.enable'));
// handleErrorIfPresent(await _remoteDebugger
// ?.sendCommand('Overlay.setPausedInDebuggerMessage', params: {
// 'message': 'Paused',
@@ -434,7 +440,8 @@
// Removes the paused at breakpoint overlay from the application.
// void _hidePausedOverlay() async {
// if (!_pausedOverlayVisible) return;
- // handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.disable'));
+ // handleErrorIfPresent(
+ // await _remoteDebugger?.sendCommand('Overlay.disable'));
// _pausedOverlayVisible = false;
// }
@@ -499,7 +506,8 @@
void logAnyFrameErrors({required String frameType}) {
if (_frameErrorCount > 0) {
logger.warning(
- 'Error calculating Dart variables for $_frameErrorCount $frameType frames.',
+ 'Error calculating Dart variables for $_frameErrorCount $frameType '
+ 'frames.',
);
}
_frameErrorCount = 0;
@@ -758,7 +766,7 @@
params,
);
}
- return result;
+ return result as T;
}
/// Returns the breakpoint ID for the provided Dart script ID and Dart line
diff --git a/dwds/lib/src/debugging/execution_context.dart b/dwds/lib/src/debugging/execution_context.dart
index 9662b39..9263888 100644
--- a/dwds/lib/src/debugging/execution_context.dart
+++ b/dwds/lib/src/debugging/execution_context.dart
@@ -52,7 +52,8 @@
'contextId': context,
},
);
- if (result.result?['result']?['value'] != null) {
+ if ((result.result?['result'] as Map<String, dynamic>?)?['value'] !=
+ null) {
_logger.fine('Found dart execution context: $context');
return context;
}
@@ -87,10 +88,11 @@
_remoteDebugger
.eventStream('Runtime.executionContextCreated', (e) {
// Parse and add the context ID to the stream.
- // If we cannot detect or parse the context ID, add `null` to the stream
- // to indicate an error context - those will be skipped when trying to find
- // the dart context, with a warning.
- final id = e.params?['context']?['id']?.toString();
+ // If we cannot detect or parse the context ID, add `null` to the
+ // stream to indicate an error context - those will be skipped when
+ // trying to find the dart context, with a warning.
+ final id = (e.params?['context'] as Map<String, dynamic>?)?['id']
+ ?.toString();
final parsedId = id == null ? null : int.parse(id);
if (id == null) {
_logger.warning('Cannot find execution context id: $e');
diff --git a/dwds/lib/src/debugging/frame_computer.dart b/dwds/lib/src/debugging/frame_computer.dart
index 2f76d28..632b9e4 100644
--- a/dwds/lib/src/debugging/frame_computer.dart
+++ b/dwds/lib/src/debugging/frame_computer.dart
@@ -108,11 +108,11 @@
columnNumber: callFrame.columnNumber,
);
- final tempWipFrame = WipCallFrame({
+ final tempWipFrame = WipCallFrame(<String, dynamic>{
'url': callFrame.url,
'functionName': callFrame.functionName,
'location': location.json,
- 'scopeChain': [],
+ 'scopeChain': <Map<String, dynamic>>[],
});
final frame = await debugger.calculateDartFrameFor(
diff --git a/dwds/lib/src/debugging/inspector.dart b/dwds/lib/src/debugging/inspector.dart
index 5827a77..c926a4a 100644
--- a/dwds/lib/src/debugging/inspector.dart
+++ b/dwds/lib/src/debugging/inspector.dart
@@ -181,7 +181,9 @@
final parts = scripts[uri];
final scriptRefs = [
ScriptRef(uri: uri, id: createId()),
- for (final part in parts ?? []) ScriptRef(uri: part, id: createId()),
+ if (parts != null)
+ for (final String part in parts)
+ ScriptRef(uri: part, id: createId()),
];
final libraryRef = await libraryHelper.libraryRefFor(uri);
final libraryId = libraryRef?.id;
diff --git a/dwds/lib/src/debugging/instance.dart b/dwds/lib/src/debugging/instance.dart
index 34b5da7..b3dfd10 100644
--- a/dwds/lib/src/debugging/instance.dart
+++ b/dwds/lib/src/debugging/instance.dart
@@ -226,8 +226,8 @@
);
}
- /// Create a plain instance of [classRef] from [remoteObject] and the JS
- /// properties [properties].
+ /// Create a plain instance of `classRef` from [remoteObject] and the JS
+ /// properties `properties`.
Future<Instance?> _plainInstanceFor(
ClassMetaData metaData,
RemoteObject remoteObject, {
@@ -331,14 +331,14 @@
return associations;
}
- /// Create a Map instance with class [classRef] from [remoteObject].
+ /// Create a Map instance with class `classRef` from [remoteObject].
///
/// Returns an instance containing [count] associations, if available,
/// starting from the [offset].
///
/// If [offset] is `null`, assumes 0 offset.
/// If [count] is `null`, return all fields starting from the offset.
- /// [length] is the expected length of the whole object, read from
+ /// `length` is the expected length of the whole object, read from
/// the [ClassMetaData].
Future<Instance?> _mapInstanceFor(
ClassMetaData metaData,
@@ -372,14 +372,14 @@
);
}
- /// Create a List instance of [classRef] from [remoteObject].
+ /// Create a List instance of `classRef` from [remoteObject].
///
/// Returns an instance containing [count] elements, if available,
/// starting from the [offset].
///
/// If [offset] is `null`, assumes 0 offset.
/// If [count] is `null`, return all fields starting from the offset.
- /// [length] is the expected length of the whole object, read from
+ /// `length` is the expected length of the whole object, read from
/// the [ClassMetaData].
Future<Instance?> _listInstanceFor(
ClassMetaData metaData,
@@ -519,7 +519,10 @@
count: namedRangeCount,
);
final namedElements =
- namedInstance?.elements?.map((e) => e.valueAsString) ?? [];
+ (namedInstance?.elements as List<InstanceRef?>?)?.map(
+ (e) => e?.valueAsString,
+ ) ??
+ [];
return [...positionalElements, ...namedElements];
}
@@ -581,14 +584,14 @@
return requested < collected ? 0 : requested - collected;
}
- /// Create a Record instance with class [classRef] from [remoteObject].
+ /// Create a Record instance with class `classRef` from [remoteObject].
///
/// Returns an instance containing [count] fields, if available,
/// starting from the [offset].
///
/// If [offset] is `null`, assumes 0 offset.
/// If [count] is `null`, return all fields starting from the offset.
- /// [length] is the expected length of the whole object, read from
+ /// `length` is the expected length of the whole object, read from
/// the [ClassMetaData].
Future<Instance?> _recordInstanceFor(
ClassMetaData metaData,
@@ -621,14 +624,14 @@
);
}
- /// Create a RecordType instance with class [classRef] from [remoteObject].
+ /// Create a RecordType instance with class `classRef` from [remoteObject].
///
/// Returns an instance containing [count] fields, if available,
/// starting from the [offset].
///
/// If [offset] is `null`, assumes 0 offset.
/// If [count] is `null`, return all fields starting from the offset.
- /// [length] is the expected length of the whole object, read from
+ /// `length` is the expected length of the whole object, read from
/// the [ClassMetaData].
Future<Instance?> _recordTypeInstanceFor(
ClassMetaData metaData,
@@ -742,13 +745,13 @@
return setInstance;
}
- /// Create Type instance with class [classRef] from [remoteObject].
+ /// Create Type instance with class `classRef` from [remoteObject].
///
/// Collect information from the internal [remoteObject] and present
/// it as an instance of [Type] class.
///
/// Returns an instance containing `hashCode` and `runtimeType` fields.
- /// [length] is the expected length of the whole object, read from
+ /// `length` is the expected length of the whole object, read from
/// the [ClassMetaData].
Future<Instance?> _plainTypeInstanceFor(
ClassMetaData metaData,
diff --git a/dwds/lib/src/debugging/location.dart b/dwds/lib/src/debugging/location.dart
index d983f28..b2c07dc 100644
--- a/dwds/lib/src/debugging/location.dart
+++ b/dwds/lib/src/debugging/location.dart
@@ -395,8 +395,9 @@
}) {
final index = entry.sourceUrlId;
if (index == null) return null;
- // Source map URLS are relative to the script. They may have platform separators
- // or they may use URL semantics. To be sure, we split and re-join them.
+ // Source map URLS are relative to the script. They may have platform
+ // separators or they may use URL semantics. To be sure, we split and
+ // re-join them.
// This works on Windows because path treats both / and \ as separators.
// It will fail if the path has both separators in it.
final relativeSegments = p.split(sourceUrls[index]);
diff --git a/dwds/lib/src/debugging/metadata/class.dart b/dwds/lib/src/debugging/metadata/class.dart
index 79037e6..0ca7182 100644
--- a/dwds/lib/src/debugging/metadata/class.dart
+++ b/dwds/lib/src/debugging/metadata/class.dart
@@ -169,7 +169,9 @@
final typeName = metadata['typeName'];
final library = metadata['libraryId'];
- final runtimeKind = RuntimeObjectKind.parse(metadata['runtimeKind']);
+ final runtimeKind = RuntimeObjectKind.parse(
+ metadata['runtimeKind'] as String,
+ );
final length = metadata['length'];
final classRef = classRefFor(library, className);
diff --git a/dwds/lib/src/debugging/metadata/function.dart b/dwds/lib/src/debugging/metadata/function.dart
index 62cdf91..3f824db 100644
--- a/dwds/lib/src/debugging/metadata/function.dart
+++ b/dwds/lib/src/debugging/metadata/function.dart
@@ -31,7 +31,9 @@
},
);
handleErrorIfPresent(response, evalContents: evalExpression);
- final name = response.result?['result']?['value'] as String?;
+ final name =
+ (response.result?['result'] as Map<String, dynamic>?)?['value']
+ as String?;
if (name == null) return FunctionMetaData('<unknown>');
if (name.isEmpty) return FunctionMetaData('Closure');
return FunctionMetaData(name);
diff --git a/dwds/lib/src/debugging/metadata/module_metadata.dart b/dwds/lib/src/debugging/metadata/module_metadata.dart
index 02e1dec..56ff614 100644
--- a/dwds/lib/src/debugging/metadata/module_metadata.dart
+++ b/dwds/lib/src/debugging/metadata/module_metadata.dart
@@ -163,8 +163,11 @@
);
}
- for (final l in _readRequiredList(json, 'libraries')) {
- addLibrary(LibraryMetadata.fromJson(l as Map<String, dynamic>));
+ for (final l in _readRequiredList<Map<String, dynamic>>(
+ json,
+ 'libraries',
+ )) {
+ addLibrary(LibraryMetadata.fromJson(l));
}
}
diff --git a/dwds/lib/src/debugging/metadata/provider.dart b/dwds/lib/src/debugging/metadata/provider.dart
index 1ebdde8..0f63940 100644
--- a/dwds/lib/src/debugging/metadata/provider.dart
+++ b/dwds/lib/src/debugging/metadata/provider.dart
@@ -22,7 +22,7 @@
final Map<String, String> _moduleToModulePath = {};
final Map<String, Set<String>> _moduleToLibraries = {};
final Map<String, List<String>> _scripts = {};
- final _metadataMemoizer = AsyncMemoizer();
+ final _metadataMemoizer = AsyncMemoizer<void>();
/// Implicitly imported libraries in any DDC component.
///
diff --git a/dwds/lib/src/debugging/modules.dart b/dwds/lib/src/debugging/modules.dart
index 7c676c9..d668039 100644
--- a/dwds/lib/src/debugging/modules.dart
+++ b/dwds/lib/src/debugging/modules.dart
@@ -96,7 +96,8 @@
return _moduleToSources[module];
}
- /// Returns the containing library importUri for the provided Dart server path.
+ /// Returns the containing library importUri for the provided Dart server
+ /// path.
Future<Uri?> libraryForSource(String serverPath) async {
await _moduleMemoizer.runOnce(_initializeMapping);
return _sourceToLibrary[serverPath];
diff --git a/dwds/lib/src/debugging/webkit_debugger.dart b/dwds/lib/src/debugging/webkit_debugger.dart
index 8a59ffd..9ed545a 100644
--- a/dwds/lib/src/debugging/webkit_debugger.dart
+++ b/dwds/lib/src/debugging/webkit_debugger.dart
@@ -83,7 +83,7 @@
);
await onReconnect?.call();
} on Exception {
- await Future.delayed(Duration(milliseconds: 25 << retryCount));
+ await Future<void>.delayed(Duration(milliseconds: 25 << retryCount));
retry = true;
retryCount++;
}
diff --git a/dwds/lib/src/dwds_vm_client.dart b/dwds/lib/src/dwds_vm_client.dart
index a8d30b5..aacfa59 100644
--- a/dwds/lib/src/dwds_vm_client.dart
+++ b/dwds/lib/src/dwds_vm_client.dart
@@ -107,11 +107,12 @@
final client = VmService(_responseStream.map(jsonEncode), (request) {
if (_requestController.isClosed) {
logger.warning(
- 'Attempted to send a request but the connection is closed:\n\n$request',
+ 'Attempted to send a request but the connection is closed:\n\n'
+ '$request',
);
return;
}
- _requestSink.add(Map<String, Object>.from(jsonDecode(request)));
+ _requestSink.add(Map<String, Object>.from(jsonDecode(request) as Map));
});
return client;
}
@@ -278,8 +279,8 @@
return <String, Object>{
'result': <String, Object>{
'views': <Object>[
- for (final isolate in isolates ?? [])
- <String, Object>{'id': isolate.id, 'isolate': isolate.toJson()},
+ for (final IsolateRef isolate in isolates ?? [])
+ <String, Object>{'id': isolate.id!, 'isolate': isolate.toJson()},
],
},
};
@@ -405,7 +406,7 @@
for (var retry = 0; retry < retries; retry++) {
final tryId = await chromeProxyService.executionContext.id;
if (tryId != null) return tryId;
- await Future.delayed(const Duration(milliseconds: waitInMs));
+ await Future<void>.delayed(const Duration(milliseconds: waitInMs));
}
throw StateError('No context with the running Dart application.');
}
@@ -422,6 +423,7 @@
logger.info('Attempting to get execution context ID.');
await tryGetContextId(chromeProxyService);
logger.info('Got execution context ID.');
+ // ignore: avoid_catching_errors
} on StateError catch (e) {
// We couldn't find the execution context. `hotRestart` may have been
// triggered in the middle of a full reload.
@@ -448,10 +450,11 @@
// Generate run id to hot restart all apps loaded into the tab.
final runId = const Uuid().v4();
- // When using the DDC library bundle format, we determine the sources that
- // were reloaded during a hot restart to then wait until all the sources are
- // parsed before finishing hot restart. This is necessary before we can
- // recompute any source location metadata in the `ChromeProxyService`.
+ // When using the DDC library bundle format, we determine the sources
+ // that were reloaded during a hot restart to then wait until all the
+ // sources are parsed before finishing hot restart. This is necessary
+ // before we can recompute any source location metadata in the
+ // `ChromeProxyService`.
// TODO(srujzs): We don't do this for the AMD module format, should we? It
// would require adding an extra parameter in the AMD strategy. As we're
// planning to deprecate it, for now, do nothing.
@@ -461,9 +464,9 @@
final reloadedSrcs = <String>{};
late StreamSubscription<String> parsedScriptsSubscription;
if (isDdcLibraryBundle) {
- // Injected client should send a request to recreate the isolate after the
- // hot restart. The creation of the isolate should in turn wait until all
- // scripts are parsed.
+ // Injected client should send a request to recreate the isolate after
+ // the hot restart. The creation of the isolate should in turn wait
+ // until all scripts are parsed.
chromeProxyService.allowedToCreateIsolate = Completer<void>();
final debugger = await chromeProxyService.debuggerFuture;
parsedScriptsSubscription = debugger.parsedScriptsController.stream
diff --git a/dwds/lib/src/events.dart b/dwds/lib/src/events.dart
index c7c9d16..3498791 100644
--- a/dwds/lib/src/events.dart
+++ b/dwds/lib/src/events.dart
@@ -101,8 +101,7 @@
DwdsEvent.getVM() : this(DwdsEventKind.getVM, {});
- DwdsEvent.resume(String? step)
- : this(DwdsEventKind.resume, {if (step != null) 'step': step});
+ DwdsEvent.resume(String? step) : this(DwdsEventKind.resume, {'step': ?step});
DwdsEvent.getSourceReport() : this(DwdsEventKind.getSourceReport, {});
diff --git a/dwds/lib/src/handlers/dev_handler.dart b/dwds/lib/src/handlers/dev_handler.dart
index cdf9be2..dbb8f0c 100644
--- a/dwds/lib/src/handlers/dev_handler.dart
+++ b/dwds/lib/src/handlers/dev_handler.dart
@@ -170,7 +170,8 @@
};
}
- /// Deserializes a message from JSON, handling custom fromJson() implementations.
+ /// Deserializes a message from JSON, handling custom fromJson()
+ /// implementations.
Object? _deserializeMessage(dynamic decoded) {
if (decoded case [final String typeName, ...]) {
// For Map-based RPC data types, the second element is the JSON map.
@@ -213,10 +214,13 @@
try {
injectedConnection.sink.add(jsonEncode(_serializeMessage(request)));
successfulSends++;
+ // ignore: avoid_catching_errors
} on StateError catch (e) {
- // The sink has already closed (app is disconnected), or another StateError occurred.
+ // The sink has already closed (app is disconnected), or another
+ // StateError occurred.
_logger.warning(
- 'Failed to send request to client, connection likely closed. Error: $e',
+ 'Failed to send request to client, connection likely closed. '
+ 'Error: $e',
);
} catch (e, s) {
// Catch any other potential errors during sending.
@@ -224,7 +228,8 @@
}
}
_logger.fine(
- 'Sent request to $successfulSends clients out of ${_injectedConnections.length} total connections',
+ 'Sent request to $successfulSends clients out of '
+ '${_injectedConnections.length} total connections',
);
return successfulSends;
}
@@ -269,7 +274,8 @@
'expression': r'window["$dartAppInstanceId"];',
'contextId': contextId,
});
- final evaluatedAppId = result.result?['result']?['value'];
+ final evaluatedAppId =
+ (result.result?['result'] as Map<String, dynamic>?)?['value'];
if (evaluatedAppId == appInstanceId) {
appTab = tab;
executionContext = RemoteDebuggerExecutionContext(
@@ -434,6 +440,7 @@
_serializeMessage(ErrorResponse(error: '$e', stackTrace: '$s')),
),
);
+ // ignore: avoid_catching_errors
} on StateError catch (_) {
// The sink has already closed (app is disconnected), swallow the
// error.
@@ -448,7 +455,8 @@
if (connection != null) {
final appId = connection.request.appId;
final services = _servicesByAppId[appId];
- // WebSocket mode doesn't need this because WebSocketProxyService handles connection tracking and cleanup
+ // WebSocket mode doesn't need this because WebSocketProxyService
+ // handles connection tracking and cleanup
if (!useWebSocketConnection) {
_appConnectionByAppId.remove(appId);
}
@@ -519,7 +527,8 @@
? 'WebSocket'
: 'Chrome';
throw UnsupportedError(
- 'Message type ${message.runtimeType} is not supported in $serviceType mode',
+ 'Message type ${message.runtimeType} is not supported in $serviceType '
+ 'mode',
);
}
}
@@ -632,7 +641,7 @@
final proxyService = appDebugServices.proxyService;
if (proxyService is! WebSocketProxyService) {
throw StateError(
- 'Expected WebSocketProxyService but got ${proxyService.runtimeType}. ',
+ 'Expected WebSocketProxyService but got ${proxyService.runtimeType}.',
);
}
await proxyService.isInitialized;
@@ -757,12 +766,14 @@
// New browser window or initial connection: run main() immediately
readyToRunMainCompleter.complete();
- // For WebSocket mode, we need to proactively create and emit a debug connection
+ // For WebSocket mode, we need to proactively create and emit a debug
+ // connection
try {
if (services != null) {
- // If we are reconnecting to an existing app but not the same instance,
- // ensure the isolate is started for the new connection before creating
- // the debug connection, otherwise it will hang waiting for initialization.
+ // If we are reconnecting to an existing app but not the same
+ // instance, ensure the isolate is started for the new connection
+ // before creating the debug connection, otherwise it will hang
+ // waiting for initialization.
await _handleIsolateStart(connection);
}
@@ -880,7 +891,8 @@
}
}
- /// Handles isolate start events for both WebSocket and Chrome-based debugging.
+ /// Handles isolate start events for both WebSocket and Chrome-based
+ /// debugging.
Future<void> _handleIsolateStart(AppConnection appConnection) async {
final appId = appConnection.request.appId;
@@ -904,10 +916,11 @@
if (!_sseHandlers.containsKey(uri.path)) {
final handler = _useSseForInjectedClient
? SseSocketHandler(
- // We provide an essentially indefinite keep alive duration because
- // the underlying connection could be lost while the application
- // is paused. The connection will get re-established after a resume
- // or cleaned up on a full page refresh.
+ // We provide an essentially indefinite keep alive duration
+ // because the underlying connection could be lost while the
+ // application is paused. The connection will get
+ // re-established after a resume or cleaned up on a full
+ // page refresh.
SseHandler(
uri,
keepAlive: const Duration(days: 3000),
diff --git a/dwds/lib/src/handlers/injector.dart b/dwds/lib/src/handlers/injector.dart
index 83728a3..610ca5b 100644
--- a/dwds/lib/src/handlers/injector.dart
+++ b/dwds/lib/src/handlers/injector.dart
@@ -193,20 +193,25 @@
final buildSettings = loadStrategy.buildSettings;
final appMetadata = globalToolConfiguration.appMetadata;
final debugSettings = globalToolConfiguration.debugSettings;
+ final reloadedSourcesPath = loadStrategy is DdcLibraryBundleStrategy
+ ? 'window.\$reloadedSourcesPath = "${loadStrategy.reloadedSourcesUri}";\n'
+ : '';
var injectedBody =
'window.\$dartAppId = "$appId";\n'
- 'window.\$dartReloadConfiguration = "${loadStrategy.reloadConfiguration}";\n'
+ 'window.\$dartReloadConfiguration = '
+ '"${loadStrategy.reloadConfiguration}";\n'
'window.\$dartModuleStrategy = "${loadStrategy.id}";\n'
'window.\$loadModuleConfig = ${loadStrategy.loadModuleSnippet};\n'
'window.\$dwdsVersion = "$packageVersion";\n'
'window.\$dwdsDevHandlerPath = "$devHandlerPath";\n'
- 'window.\$dwdsEnableDevToolsLaunch = ${debugSettings.enableDevToolsLaunch};\n'
+ 'window.\$dwdsEnableDevToolsLaunch = '
+ '${debugSettings.enableDevToolsLaunch};\n'
'window.\$dartEntrypointPath = "$entrypointPath";\n'
'window.\$dartEmitDebugEvents = ${debugSettings.emitDebugEvents};\n'
'window.\$isInternalBuild = ${appMetadata.isInternalBuild};\n'
'window.\$isFlutterApp = ${buildSettings.isFlutterApp};\n'
- '${loadStrategy is DdcLibraryBundleStrategy ? 'window.\$reloadedSourcesPath = "${loadStrategy.reloadedSourcesUri.toString()}";\n' : ''}'
+ '$reloadedSourcesPath'
'${loadStrategy.loadClientSnippet(_clientScript)}';
if (extensionUri != null) {
diff --git a/dwds/lib/src/handlers/socket_connections.dart b/dwds/lib/src/handlers/socket_connections.dart
index bf99f7c..b127f35 100644
--- a/dwds/lib/src/handlers/socket_connections.dart
+++ b/dwds/lib/src/handlers/socket_connections.dart
@@ -24,7 +24,8 @@
void shutdown();
}
-/// A handler that accepts (transport-agnostic) bidirectional socket connections.
+/// A handler that accepts (transport-agnostic) bidirectional socket
+/// connections.
abstract class SocketHandler {
StreamQueue<SocketConnection> get connections;
FutureOr<Response> handler(Request request);
@@ -32,7 +33,8 @@
}
/// An implementation of [SocketConnection] that users server-sent events (SSE)
-/// and HTTP POSTS for bidirectional communication by wrapping an [SseConnection].
+/// and HTTP POSTS for bidirectional communication by wrapping an
+/// [SseConnection].
class SseSocketConnection extends SocketConnection {
final SseConnection _connection;
@@ -76,7 +78,8 @@
void shutdown() => _sseHandler.shutdown();
}
-/// An implementation of [SocketConnection] that uses WebSockets for communication
+/// An implementation of [SocketConnection] that uses WebSockets for
+/// communication by wrapping [WebSocketChannel].
/// by wrapping [WebSocketChannel].
class WebSocketConnection extends SocketConnection {
final WebSocketChannel _channel;
diff --git a/dwds/lib/src/injected/client.js b/dwds/lib/src/injected/client.js
index b087dec..f2aa9e3 100644
--- a/dwds/lib/src/injected/client.js
+++ b/dwds/lib/src/injected/client.js
@@ -1,4 +1,4 @@
-// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.12.0-229.0.dev.
+// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.12.0-edge.83af3d8632f635ab5220f1b1971e7d743975da52.
// The code supports the following hooks:
// dartPrint(message):
// if this function is defined it is called instead of the Dart [print]
@@ -11324,7 +11324,7 @@
call$1(tag) {
return this.prototypeForTag(A._asString(tag));
},
- $signature: 90
+ $signature: 30
};
A._Record.prototype = {
get$runtimeType(_) {
@@ -14195,7 +14195,7 @@
call$1(v) {
return this.K._is(v);
},
- $signature: 41
+ $signature: 42
};
A._HashSet.prototype = {
get$iterator(_) {
@@ -16342,7 +16342,7 @@
call$2(msg, position) {
throw A.wrapException(A.FormatException$("Illegal IPv6 address, " + msg, this.host, position));
},
- $signature: 73
+ $signature: 89
};
A._Uri.prototype = {
get$_text() {
@@ -17000,7 +17000,7 @@
t1.call(t1, wrapper);
return wrapper;
},
- $signature: 42
+ $signature: 44
};
A.FutureOfVoidToJSPromise_get_toJS_closure.prototype = {
call$2(resolve, reject) {
@@ -17014,7 +17014,7 @@
var t1 = this.resolve;
return t1.call(t1);
},
- $signature: 44
+ $signature: 67
};
A.FutureOfVoidToJSPromise_get_toJS__closure0.prototype = {
call$2(error, stackTrace) {
@@ -17539,7 +17539,7 @@
call$1(e) {
return type$.BuildStatus._as(e)._name === this.json;
},
- $signature: 67
+ $signature: 73
};
A.BuildStatus_BuildStatus$fromJson_closure0.prototype = {
call$0() {
@@ -17621,7 +17621,7 @@
call$1(e) {
return type$.DebugEvent._as(e).toJson$0();
},
- $signature: 89
+ $signature: 90
};
A.DebugInfo.prototype = {
toJson$0() {
@@ -18296,10 +18296,11 @@
A._PersistentWebSocket_Object_StreamChannelMixin.prototype = {};
A.safeUnawaited_closure.prototype = {
call$2(error, stackTrace) {
+ A._asObject(error);
type$.StackTrace._as(stackTrace);
return $.$get$_logger().log$4(B.Level_WARNING_900, "Error in unawaited Future:", error, stackTrace);
},
- $signature: 24
+ $signature: 6
};
A.Uuid.prototype = {
v4$0() {
@@ -18647,13 +18648,13 @@
} else
t1._contents = t3 + value;
},
- $signature: 30
+ $signature: 29
};
A.MediaType_toString__closure.prototype = {
call$1(match) {
return "\\" + A.S(match.$index(0, 0));
},
- $signature: 25
+ $signature: 24
};
A.expectQuotedString_closure.prototype = {
call$1(match) {
@@ -18661,7 +18662,7 @@
t1.toString;
return t1;
},
- $signature: 25
+ $signature: 24
};
A.Level.prototype = {
$eq(_, other) {
@@ -18984,13 +18985,13 @@
call$1(part) {
return A._asString(part) !== "";
},
- $signature: 26
+ $signature: 25
};
A.Context_split_closure.prototype = {
call$1(part) {
return A._asString(part).length !== 0;
},
- $signature: 26
+ $signature: 25
};
A._validateArgList_closure.prototype = {
call$1(arg) {
@@ -21464,13 +21465,13 @@
A._asJSObject(A._asJSObject(init.G.dartDevEmbedder).config).capturedMainHandler = null;
A.safeUnawaited(this.$this._runMainWhenReady$2(this.readyToRunMain, runMain));
},
- $signature: 27
+ $signature: 26
};
A.DdcLibraryBundleRestarter_hotReloadStart_closure.prototype = {
call$1(hotReloadEndCallback) {
this.$this._capturedHotReloadEndCallback = type$.JavaScriptFunction._as(hotReloadEndCallback);
},
- $signature: 27
+ $signature: 26
};
A.DdcRestarter.prototype = {
restart$3$readyToRunMain$reloadedSourcesPath$runId(readyToRunMain, reloadedSourcesPath, runId) {
@@ -21990,8 +21991,8 @@
return A._asyncStartSync($async$_reload$1, $async$completer);
},
_reloadModule$1(moduleId) {
- var t1 = new A._Future($.Zone__current, type$._Future_dynamic),
- completer = new A._AsyncCompleter(t1, type$._AsyncCompleter_dynamic),
+ var t1 = new A._Future($.Zone__current, type$._Future_void),
+ completer = new A._AsyncCompleter(t1, type$._AsyncCompleter_void),
stackTrace = A.StackTrace_current();
type$.JavaScriptObject._as(init.G.$requireLoader).forceLoadModule(moduleId, A._functionToJS0(new A.RequireRestarter__reloadModule_closure(completer)), A._functionToJS1(new A.RequireRestarter__reloadModule_closure0(completer, stackTrace)));
return t1;
@@ -22100,7 +22101,7 @@
_instance_2_u = hunkHelpers._instance_2u,
_instance_0_u = hunkHelpers._instance_0u,
_instance_1_i = hunkHelpers._instance_1i;
- _static_2(J, "_interceptors_JSArray__compareAny$closure", "JSArray__compareAny", 28);
+ _static_2(J, "_interceptors_JSArray__compareAny$closure", "JSArray__compareAny", 27);
_instance_1_u(A.CastStreamSubscription.prototype, "get$__internal$_onData", "__internal$_onData$1", 7);
_static_1(A, "async__AsyncRun__scheduleImmediateJsOverride$closure", "_AsyncRun__scheduleImmediateJsOverride", 9);
_static_1(A, "async__AsyncRun__scheduleImmediateWithSetImmediate$closure", "_AsyncRun__scheduleImmediateWithSetImmediate", 9);
@@ -22150,16 +22151,16 @@
_instance_0_u(_ = A._ForwardingStreamSubscription.prototype, "get$_onPause", "_onPause$0", 0);
_instance_0_u(_, "get$_onResume", "_onResume$0", 0);
_instance_1_u(_, "get$_handleData", "_handleData$1", 7);
- _instance_2_u(_, "get$_handleError", "_handleError$2", 24);
+ _instance_2_u(_, "get$_handleError", "_handleError$2", 41);
_instance_0_u(_, "get$_handleDone", "_handleDone$0", 0);
- _static_2(A, "collection___defaultEquals$closure", "_defaultEquals0", 29);
+ _static_2(A, "collection___defaultEquals$closure", "_defaultEquals0", 28);
_static_1(A, "collection___defaultHashCode$closure", "_defaultHashCode", 16);
- _static_2(A, "collection_ListBase__compareAny$closure", "ListBase__compareAny", 28);
+ _static_2(A, "collection_ListBase__compareAny$closure", "ListBase__compareAny", 27);
_static_1(A, "convert___defaultToEncodable$closure", "_defaultToEncodable", 20);
_instance_1_i(_ = A._ByteCallbackSink.prototype, "get$add", "add$1", 7);
_instance_0_u(_, "get$close", "close$0", 0);
_static_1(A, "core__identityHashCode$closure", "identityHashCode", 16);
- _static_2(A, "core__identical$closure", "identical", 29);
+ _static_2(A, "core__identical$closure", "identical", 28);
_static_1(A, "core_Uri_decodeComponent$closure", "Uri_decodeComponent", 11);
_static(A, "math__max$closure", 2, null, ["call$1$2", "call$2"], ["max", function(a, b) {
return A.max(a, b, type$.num);
@@ -22290,7 +22291,7 @@
typeUniverse: {eC: new Map(), tR: {}, eT: {}, tPV: {}, sEA: []},
mangledGlobalNames: {int: "int", double: "double", num: "num", String: "String", bool: "bool", Null: "Null", List: "List", Object: "Object", Map: "Map", JSObject: "JSObject"},
mangledNames: {},
- types: ["~()", "Null()", "~(JSObject)", "Null(Object,StackTrace)", "Null(@)", "~(@)", "~(Object,StackTrace)", "~(Object?)", "JSObject()", "~(~())", "Future<~>()", "String(String)", "Object?(Object?)", "bool(_Highlight)", "Null(JSObject)", "Null(String)", "int(Object?)", "~(Object?,Object?)", "@()", "Null(JavaScriptFunction,JavaScriptFunction)", "@(@)", "int()", "bool()", "Future<~>(String)", "~(@,StackTrace)", "String(Match)", "bool(String)", "Null(JavaScriptFunction)", "int(@,@)", "bool(Object?,Object?)", "~(String,String)", "Null(@,StackTrace)", "PersistentWebSocket(WebSocket)", "~(Zone,ZoneDelegate,Zone,Object,StackTrace)", "Future<~>(WebSocketEvent)", "bool(String,String)", "int(String)", "Null(String,String[Object?])", "bool(Object)", "~(List<int>)", "MediaType()", "bool(Object?)", "JSObject(Object,StackTrace)", "Logger()", "Object?(~)", "String(String?)", "String(@)", "int(_Line)", "~(int,@)", "Object(_Line)", "Object(_Highlight)", "int(_Highlight,_Highlight)", "List<_Line>(MapEntry<Object,List<_Highlight>>)", "0&()", "SourceSpanWithContext()", "_Future<@>?()", "~(String?)", "Future<Null>()", "~(Object[StackTrace?])", "Null(~())", "JSObject(String[bool?])", "~(StreamSink<@>)", "~(List<DebugEvent>)", "Null(String,String)", "~(bool)", "0^(0^,0^)<num>", "HotRestartResponse(String,bool,String?)", "bool(BuildStatus)", "bool(bool)", "List<String>(String)", "int(String,String)", "Null(JavaScriptObject)", "JSObject()()", "0&(String,int?)", "@(@,String)", "~(Zone?,ZoneDelegate?,Zone,Object,StackTrace)", "0^(Zone?,ZoneDelegate?,Zone,0^())<Object?>", "0^(Zone?,ZoneDelegate?,Zone,0^(1^),1^)<Object?,Object?>", "0^(Zone?,ZoneDelegate?,Zone,0^(1^,2^),1^,2^)<Object?,Object?,Object?>", "0^()(Zone,ZoneDelegate,Zone,0^())<Object?>", "0^(1^)(Zone,ZoneDelegate,Zone,0^(1^))<Object?,Object?>", "0^(1^,2^)(Zone,ZoneDelegate,Zone,0^(1^,2^))<Object?,Object?,Object?>", "AsyncError?(Zone,ZoneDelegate,Zone,Object,StackTrace?)", "~(Zone?,ZoneDelegate?,Zone,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~(Timer))", "~(Zone,ZoneDelegate,Zone,String)", "~(String)", "Zone(Zone?,ZoneDelegate?,Zone,ZoneSpecification?,Map<Object?,Object?>?)", "Map<String,@>(DebugEvent)", "@(String)", "HotReloadResponse(String,bool,String?)", "String?()"],
+ types: ["~()", "Null()", "~(JSObject)", "Null(Object,StackTrace)", "Null(@)", "~(@)", "~(Object,StackTrace)", "~(Object?)", "JSObject()", "~(~())", "Future<~>()", "String(String)", "Object?(Object?)", "bool(_Highlight)", "Null(JSObject)", "Null(String)", "int(Object?)", "~(Object?,Object?)", "@()", "Null(JavaScriptFunction,JavaScriptFunction)", "@(@)", "int()", "bool()", "Future<~>(String)", "String(Match)", "bool(String)", "Null(JavaScriptFunction)", "int(@,@)", "bool(Object?,Object?)", "~(String,String)", "@(String)", "Null(@,StackTrace)", "PersistentWebSocket(WebSocket)", "~(Zone,ZoneDelegate,Zone,Object,StackTrace)", "Future<~>(WebSocketEvent)", "bool(String,String)", "int(String)", "Null(String,String[Object?])", "bool(Object)", "~(List<int>)", "MediaType()", "~(@,StackTrace)", "bool(Object?)", "Logger()", "JSObject(Object,StackTrace)", "String(String?)", "String(@)", "int(_Line)", "~(int,@)", "Object(_Line)", "Object(_Highlight)", "int(_Highlight,_Highlight)", "List<_Line>(MapEntry<Object,List<_Highlight>>)", "0&()", "SourceSpanWithContext()", "_Future<@>?()", "~(String?)", "Future<Null>()", "~(Object[StackTrace?])", "Null(~())", "JSObject(String[bool?])", "~(StreamSink<@>)", "~(List<DebugEvent>)", "Null(String,String)", "~(bool)", "0^(0^,0^)<num>", "HotRestartResponse(String,bool,String?)", "Object?(~)", "bool(bool)", "List<String>(String)", "int(String,String)", "Null(JavaScriptObject)", "JSObject()()", "bool(BuildStatus)", "@(@,String)", "~(Zone?,ZoneDelegate?,Zone,Object,StackTrace)", "0^(Zone?,ZoneDelegate?,Zone,0^())<Object?>", "0^(Zone?,ZoneDelegate?,Zone,0^(1^),1^)<Object?,Object?>", "0^(Zone?,ZoneDelegate?,Zone,0^(1^,2^),1^,2^)<Object?,Object?,Object?>", "0^()(Zone,ZoneDelegate,Zone,0^())<Object?>", "0^(1^)(Zone,ZoneDelegate,Zone,0^(1^))<Object?,Object?>", "0^(1^,2^)(Zone,ZoneDelegate,Zone,0^(1^,2^))<Object?,Object?,Object?>", "AsyncError?(Zone,ZoneDelegate,Zone,Object,StackTrace?)", "~(Zone?,ZoneDelegate?,Zone,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~())", "Timer(Zone,ZoneDelegate,Zone,Duration,~(Timer))", "~(Zone,ZoneDelegate,Zone,String)", "~(String)", "Zone(Zone?,ZoneDelegate?,Zone,ZoneSpecification?,Map<Object?,Object?>?)", "0&(String,int?)", "Map<String,@>(DebugEvent)", "HotReloadResponse(String,bool,String?)", "String?()"],
interceptorsByTag: null,
leafTags: null,
arrayRti: Symbol("$ti"),
diff --git a/dwds/lib/src/loaders/build_runner_strategy_provider.dart b/dwds/lib/src/loaders/build_runner_strategy_provider.dart
index 65025dd..0db14fc 100644
--- a/dwds/lib/src/loaders/build_runner_strategy_provider.dart
+++ b/dwds/lib/src/loaders/build_runner_strategy_provider.dart
@@ -51,7 +51,8 @@
RequireStrategy get strategy => _requireStrategy;
}
-/// Provides a [DdcLibraryBundleStrategy] suitable for use with `package:build_runner`.
+/// Provides a [DdcLibraryBundleStrategy] suitable for use with
+/// `package:build_runner`.
class BuildRunnerDdcLibraryBundleStrategyProvider
with BuildRunnerStrategyProviderMixin {
@override
diff --git a/dwds/lib/src/loaders/ddc.dart b/dwds/lib/src/loaders/ddc.dart
index 1ae77fa..29c2a29 100644
--- a/dwds/lib/src/loaders/ddc.dart
+++ b/dwds/lib/src/loaders/ddc.dart
@@ -127,7 +127,7 @@
/// an app URI.
final String? Function(String appUri) _serverPathForAppUri;
- /// Returns the relative path in google3, determined by the [absolutePath].
+ /// Returns the relative path in google3, determined by the `absolutePath`.
///
/// Returns `null` if not a google3 app.
final String? Function(String absolutePath) _g3RelativePath;
diff --git a/dwds/lib/src/loaders/ddc_library_bundle.dart b/dwds/lib/src/loaders/ddc_library_bundle.dart
index e5832d7..f3889ef 100644
--- a/dwds/lib/src/loaders/ddc_library_bundle.dart
+++ b/dwds/lib/src/loaders/ddc_library_bundle.dart
@@ -97,7 +97,7 @@
/// an app URI.
final String? Function(String appUri) _serverPathForAppUri;
- /// Returns the relative path in google3, determined by the [absolutePath].
+ /// Returns the relative path in google3, determined by the `absolutePath`.
///
/// Returns `null` if not a google3 app.
final String? Function(String absolutePath) _g3RelativePath;
diff --git a/dwds/lib/src/loaders/strategy.dart b/dwds/lib/src/loaders/strategy.dart
index e38cea0..9be33e2 100644
--- a/dwds/lib/src/loaders/strategy.dart
+++ b/dwds/lib/src/loaders/strategy.dart
@@ -79,8 +79,9 @@
String get _defaultPackageConfigPath =>
p.join(DartUri.currentDirectory, '.dart_tool', 'package_config.json');
- /// Returns the absolute file path of the `package_config.json` file in the `.dart_tool`
- /// directory, searching recursively from the current directory hierarchy.
+ /// Returns the absolute file path of the `package_config.json` file in the
+ /// `.dart_tool` directory, searching recursively from the current directory
+ /// hierarchy.
static String? _findPackageConfigFilePath() {
var candidateDir = Directory(DartUri.currentDirectory).absolute;
diff --git a/dwds/lib/src/readers/frontend_server_asset_reader.dart b/dwds/lib/src/readers/frontend_server_asset_reader.dart
index 2f705f4..a87b459 100644
--- a/dwds/lib/src/readers/frontend_server_asset_reader.dart
+++ b/dwds/lib/src/readers/frontend_server_asset_reader.dart
@@ -112,10 +112,11 @@
final sourceInfo =
jsonDecode(json.readAsStringSync()) as Map<String, dynamic>;
for (final key in sourceInfo.keys) {
- final info = sourceInfo[key];
+ final info = sourceInfo[key] as Map<String, dynamic>;
+ final sourcemapOffsets = info['sourcemap'] as List<dynamic>;
_mapContents[key] = utf8.decode(
sourceContents
- .getRange(info['sourcemap'][0] as int, info['sourcemap'][1] as int)
+ .getRange(sourcemapOffsets[0] as int, sourcemapOffsets[1] as int)
.toList(),
);
}
diff --git a/dwds/lib/src/servers/extension_debugger.dart b/dwds/lib/src/servers/extension_debugger.dart
index d5a8f82..8240b86 100644
--- a/dwds/lib/src/servers/extension_debugger.dart
+++ b/dwds/lib/src/servers/extension_debugger.dart
@@ -93,10 +93,11 @@
'method': json.decode(message.method),
'params': json.decode(message.params),
};
- // Note: package:sse will try to keep the connection alive, even after
- // the client has been closed. Therefore the extension sends an event to
- // notify DWDS that we should close the connection, instead of relying
- // on the done event sent when the client is closed. See details:
+ // Note: package:sse will try to keep the connection alive, even
+ // after the client has been closed. Therefore the extension sends an
+ // event to notify DWDS that we should close the connection, instead
+ // of relying on the done event sent when the client is closed. See
+ // details:
// https://github.com/dart-lang/webdev/pull/1595#issuecomment-1116773378
if (map['method'] == 'DebugExtension.detached') {
close();
@@ -166,6 +167,7 @@
),
),
);
+ // ignore: avoid_catching_errors
} on StateError catch (error, stackTrace) {
if (error.message.contains('Cannot add event after closing')) {
_logger.severe('Socket connection closed. Shutting down debugger.');
@@ -198,7 +200,8 @@
void closeWithError(Object? error) {
_logger.shout(
- 'Closing extension debugger due to error. Restart app for debugging functionality',
+ 'Closing extension debugger due to error. Restart app for debugging '
+ 'functionality',
error,
);
close();
diff --git a/dwds/lib/src/services/batched_expression_evaluator.dart b/dwds/lib/src/services/batched_expression_evaluator.dart
index fbdf9ef..164b04b 100644
--- a/dwds/lib/src/services/batched_expression_evaluator.dart
+++ b/dwds/lib/src/services/batched_expression_evaluator.dart
@@ -84,7 +84,7 @@
if (libraryUri != request.libraryUri ||
isolateId != request.isolateId ||
- !MapEquality().equals(scope, request.scope)) {
+ !const MapEquality<String, String>().equals(scope, request.scope)) {
_logger.fine('New batch due to');
if (libraryUri != request.libraryUri) {
_logger.fine(' - library uri: $libraryUri != ${request.libraryUri}');
@@ -92,7 +92,7 @@
if (isolateId != request.isolateId) {
_logger.fine(' - isolateId: $isolateId != ${request.isolateId}');
}
- if (!MapEquality().equals(scope, request.scope)) {
+ if (!const MapEquality<String, String>().equals(scope, request.scope)) {
_logger.fine(' - scope: $scope != ${request.scope}');
}
@@ -158,8 +158,7 @@
);
request.completer.complete(result);
}),
- onError: (error, stackTrace) =>
- request.completer.completeError(error, stackTrace),
+ onError: request.completer.completeError,
);
}
}
diff --git a/dwds/lib/src/services/chrome/chrome_debug_exception.dart b/dwds/lib/src/services/chrome/chrome_debug_exception.dart
index 3a33022..82e377d 100644
--- a/dwds/lib/src/services/chrome/chrome_debug_exception.dart
+++ b/dwds/lib/src/services/chrome/chrome_debug_exception.dart
@@ -21,7 +21,7 @@
this.evalContents,
}) : super(exceptionDetails) {
final json = exceptionDetails['stackTrace'];
- stackTrace = json == null ? null : StackTrace(json);
+ stackTrace = json == null ? null : StackTrace(json as Map<String, dynamic>);
}
@override
diff --git a/dwds/lib/src/services/chrome/chrome_proxy_service.dart b/dwds/lib/src/services/chrome/chrome_proxy_service.dart
index 876da4b..642177d 100644
--- a/dwds/lib/src/services/chrome/chrome_proxy_service.dart
+++ b/dwds/lib/src/services/chrome/chrome_proxy_service.dart
@@ -31,7 +31,8 @@
import 'package:logging/logging.dart' hide LogRecord;
import 'package:vm_service/vm_service.dart' hide vmServiceVersion;
import 'package:vm_service_interface/vm_service_interface.dart';
-import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
+import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'
+ hide StackTrace;
/// A proxy from the chrome debug protocol to the dart vm service protocol.
final class ChromeProxyService extends ProxyService<ChromeAppInspector> {
@@ -370,7 +371,7 @@
/// Should be called when there is a hot restart or full page refresh.
///
- /// Clears out the [_inspector] and all related cached information.
+ /// Clears out the [inspector] and all related cached information.
@override
void destroyIsolate() {
_logger.fine('$hashCode Destroying isolate');
@@ -1252,7 +1253,7 @@
break;
case 'dart.developer.log':
await _handleDeveloperLog(isolateRef, event).catchError(
- (error, stackTrace) => _logger.warning(
+ (Object error, StackTrace stackTrace) => _logger.warning(
'Error handling developer log:',
error,
stackTrace,
@@ -1269,8 +1270,9 @@
IsolateRef isolateRef,
ConsoleAPIEvent event,
) async {
- final logObject = event.params?['args'][1] as Map?;
- final objectId = logObject?['objectId'];
+ final logObject =
+ (event.params?['args'] as List<dynamic>?)?[1] as Map<String, dynamic>?;
+ final objectId = logObject?['objectId'] as String?;
// Always attempt to fetch the full properties instead of relying on
// `RemoteObject.preview` which only has truncated log messages:
// https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject
@@ -1307,7 +1309,7 @@
Future<Map<String, RemoteObject>> _fetchFullLogParams(
String objectId, {
- required Map? logObject,
+ required Map<String, dynamic>? logObject,
}) async {
final logParams = <String, RemoteObject>{};
for (final property in await inspector.getProperties(objectId)) {
@@ -1326,9 +1328,13 @@
return logParams;
}
- Map<String, RemoteObject> _fetchAbbreviatedLogParams(Map? logObject) {
+ Map<String, RemoteObject> _fetchAbbreviatedLogParams(
+ Map<String, dynamic>? logObject,
+ ) {
final logParams = <String, RemoteObject>{};
- for (final dynamic property in logObject?['preview']?['properties'] ?? []) {
+ final preview = logObject?['preview'] as Map<String, dynamic>?;
+ final properties = preview?['properties'] as List<dynamic>?;
+ for (final dynamic property in properties ?? []) {
if (property is Map<String, dynamic> && property['name'] != null) {
logParams[property['name'] as String] = RemoteObject(property);
}
diff --git a/dwds/lib/src/services/debug_service.dart b/dwds/lib/src/services/debug_service.dart
index 787a277..3e07924 100644
--- a/dwds/lib/src/services/debug_service.dart
+++ b/dwds/lib/src/services/debug_service.dart
@@ -37,7 +37,8 @@
required this.useSse,
});
- /// The URI pointing to the VM service implementation hosted by the [DebugService].
+ /// The URI pointing to the VM service implementation hosted by the
+ /// [DebugService].
String get uri => _uri.toString();
Uri get _uri => _cachedUri ??= () {
@@ -163,9 +164,9 @@
void Function(Map<String, Object?>)? onResponse,
}) {
return _wrapHandler(
- webSocketHandler((webSocket, subprotocol) {
+ webSocketHandler((Object webSocket, String? subprotocol) {
handleConnection(
- webSocket,
+ webSocket as StreamChannel,
proxyService,
serviceExtensionRegistry,
onRequest: onRequest,
@@ -181,7 +182,7 @@
if (!_acceptNewConnections) {
return shelf.Response.forbidden(
'Cannot connect directly to the VM service as a Dart Development '
- 'Service (DDS) instance has taken control and can be found at $_ddsUri.'
+ 'Service (DDS) instance has taken control and can be found at '
'$_ddsUri.',
);
}
@@ -210,8 +211,8 @@
// while also being able to determine which client invoked the RPC
// without some form of client ID.
//
- // We can probably do better than this, but it will likely involve some
- // refactoring.
+ // We can probably do better than this, but it will likely involve
+ // some refactoring.
if (response case {
'error': {
'code': DisconnectNonDartDevelopmentServiceClients.kErrorCode,
@@ -240,7 +241,9 @@
'socket, expected a List<int> or String.',
);
}
- final request = Map<String, Object>.from(jsonDecode(value));
+ final request = Map<String, Object>.from(
+ jsonDecode(value as String) as Map,
+ );
if (onRequest != null) onRequest(request);
return request;
});
diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart
index 85d6a0e..7e3b37f 100644
--- a/dwds/lib/src/services/expression_compiler_service.dart
+++ b/dwds/lib/src/services/expression_compiler_service.dart
@@ -107,7 +107,7 @@
}
Future<bool> updateDependencies(Map<String, ModuleInfo> modules) async {
- final updateCompleter = Completer();
+ final updateCompleter = Completer<void>();
_dependencyUpdate = updateCompleter.future;
_logger.info('Updating dependencies...');
@@ -219,7 +219,7 @@
/// Uses [_address] and [_port] to communicate and to redirect asset
/// requests to the asset server.
///
-/// Configuration created by [_sdkConfigurationProvider] describes the
+/// Configuration created by [sdkConfigurationProvider] describes the
/// locations of SDK files used in expression compilation (summaries,
/// libraries spec, compiler worker snapshot).
///
diff --git a/dwds/lib/src/services/expression_evaluator.dart b/dwds/lib/src/services/expression_evaluator.dart
index b8cb71c..1230b96 100644
--- a/dwds/lib/src/services/expression_evaluator.dart
+++ b/dwds/lib/src/services/expression_evaluator.dart
@@ -46,7 +46,8 @@
'org-dartlang-debug:synthetic_debug_expression:.*:.*Error: ',
);
- /// Find module path from the XHR call network error message received from chrome.
+ /// Find module path from the XHR call network error message received from
+ /// chrome.
///
/// Example:
/// NetworkError: Failed to load `http://<hostname>.com/path/to/module.js?<cache_busting_token>`
diff --git a/dwds/lib/src/services/proxy_service.dart b/dwds/lib/src/services/proxy_service.dart
index 3e69ca7..24b2642 100644
--- a/dwds/lib/src/services/proxy_service.dart
+++ b/dwds/lib/src/services/proxy_service.dart
@@ -30,9 +30,9 @@
required super.timestamp,
required this.uri,
}) : message =
- 'A Dart Developer Service instance has connected and this direct '
- 'connection to the VM service will now be closed. Please reconnect to '
- 'the Dart Development Service at $uri.',
+ 'A Dart Developer Service instance has connected and this '
+ 'direct connection to the VM service will now be closed. '
+ 'Please reconnect to the Dart Development Service at $uri.',
super(kind: 'DartDevelopmentServiceConnected');
final String message;
diff --git a/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart b/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart
index d452899..9d07ccf 100644
--- a/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart
+++ b/dwds/lib/src/services/web_socket/web_socket_proxy_service.dart
@@ -28,7 +28,8 @@
/// Grace period before destroying isolate when no clients are detected.
/// This handles the race condition during page refresh where the old connection
-/// closes before the new connection is established, preventing premature isolate destruction.
+/// closes before the new connection is established, preventing premature
+/// isolate destruction.
const _isolateDestructionGracePeriod = Duration(seconds: 15);
/// Error message when no clients are available for hot reload/restart.
@@ -216,7 +217,8 @@
);
} else {
_logger.fine(
- 'Reconnecting existing connection: $connectionId (total: $_activeConnectionCount)',
+ 'Reconnecting existing connection: $connectionId (total: '
+ '$_activeConnectionCount)',
);
}
@@ -229,10 +231,12 @@
_handleConnectionClosed(connectionId);
});
- // If we already have a running isolate, just update the connection and return
+ // If we already have a running isolate, just update the connection and
+ // return
if (isIsolateRunning) {
_logger.fine(
- 'Reusing existing isolate ${inspector.isolateRef.id} for connection: $connectionId',
+ 'Reusing existing isolate ${inspector.isolateRef.id} for connection: '
+ '$connectionId',
);
return;
}
@@ -293,16 +297,19 @@
// Decrease active connection count
_activeConnectionCount--;
_logger.fine(
- 'Removed connection: $connectionId (remaining: $_activeConnectionCount)',
+ 'Removed connection: $connectionId (remaining: '
+ '$_activeConnectionCount)',
);
_logger.fine(
- 'Current tracked connections: ${_appConnectionDoneSubscriptions.keys.toList()}',
+ 'Current tracked connections: '
+ '${_appConnectionDoneSubscriptions.keys.toList()}',
);
// Instead of destroying the isolate immediately, check if there are still
// clients that can receive hot reload requests
if (_activeConnectionCount <= 0) {
- // Double-check by asking the sendClientRequest callback how many clients are available
+ // Double-check by asking the sendClientRequest callback how many
+ // clients are available
final actualClientCount = sendClientRequest({'type': 'ping'});
_logger.fine(
'Actual client count from sendClientRequest: $actualClientCount',
@@ -310,9 +317,11 @@
if (actualClientCount == 0) {
_logger.fine(
- 'No clients available for hot reload, scheduling isolate destruction',
+ 'No clients available for hot reload, scheduling isolate '
+ 'destruction',
);
- // Add a delay before destroying the isolate to handle page refresh race condition
+ // Add a delay before destroying the isolate to handle page refresh
+ // race condition
Timer(_isolateDestructionGracePeriod, () {
// Double-check client count again before destroying
final finalClientCount = sendClientRequest({'type': 'ping'});
@@ -323,21 +332,24 @@
destroyIsolate();
} else {
_logger.fine(
- 'Final check found $finalClientCount clients, keeping isolate alive',
+ 'Final check found $finalClientCount clients, keeping isolate '
+ 'alive',
);
_activeConnectionCount = finalClientCount;
}
});
} else {
_logger.fine(
- 'Still have $actualClientCount clients available, keeping isolate alive',
+ 'Still have $actualClientCount clients available, keeping isolate '
+ 'alive',
);
// Update our internal counter to match reality
_activeConnectionCount = actualClientCount;
}
} else {
_logger.fine(
- 'Still have $_activeConnectionCount active connections, keeping isolate alive',
+ 'Still have $_activeConnectionCount active connections, keeping '
+ 'isolate alive',
);
}
} else {
@@ -409,8 +421,8 @@
_logger.info('Hot reload completed successfully');
return _ReloadReportWithMetadata(success: true);
} on NoClientsAvailableException catch (e) {
- // Throw RPC error with kIsolateCannotReload code when no browser clients are
- // connected.
+ // Throw RPC error with kIsolateCannotReload code when no browser clients
+ // are connected.
throw vm_service.RPCError(
'reloadSources',
vm_service.RPCErrorKind.kIsolateCannotReload.code,
@@ -431,8 +443,8 @@
_logger.info('Hot restart completed successfully');
return {'result': vm_service.Success().toJson()};
} on NoClientsAvailableException catch (e) {
- // Throw RPC error with kIsolateCannotReload code when no browser clients are
- // connected.
+ // Throw RPC error with kIsolateCannotReload code when no browser clients
+ // are connected.
throw vm_service.RPCError(
'hotRestart',
vm_service.RPCErrorKind.kIsolateCannotReload.code,
@@ -456,7 +468,8 @@
if (tracker == null) {
_logger.warning(
- 'Received hot reload response but no pending tracker found (id: ${response.id})',
+ 'Received hot reload response but no pending tracker found (id: '
+ '${response.id})',
);
return;
}
@@ -488,7 +501,8 @@
if (tracker == null) {
_logger.warning(
- 'Received hot restart response but no pending tracker found (id: ${response.id})',
+ 'Received hot restart response but no pending tracker found (id: '
+ '${response.id})',
);
return;
}
diff --git a/dwds/lib/src/sockets.dart b/dwds/lib/src/sockets.dart
index 331917e..47741db 100644
--- a/dwds/lib/src/sockets.dart
+++ b/dwds/lib/src/sockets.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import 'dart:async';
+import 'dart:io' show SocketException;
import 'dart:typed_data';
import 'package:logging/logging.dart';
@@ -61,7 +62,7 @@
this.logger,
});
- /// Creates a [PersistentWebSocket] instance connected to [url].
+ /// Creates a [PersistentWebSocket] instance connected to [uri].
///
/// [debugName] is a string included in logs written by this class to provide
/// additional information about the purpose of this connection.
@@ -78,7 +79,7 @@
///
/// No retries are attempted when making the initial web socket connection,
/// so callers must be prepared to handle both [SocketException]s and
- /// [WebSocketException] thrown if the connection to [url] fails.
+ /// [WebSocketException] thrown if the connection to [uri] fails.
static Future<PersistentWebSocket> connect(
Uri uri, {
String debugName = kDefaultDebugName,
diff --git a/dwds/lib/src/utilities/dart_uri.dart b/dwds/lib/src/utilities/dart_uri.dart
index 066f6f5..3c0b6f9 100644
--- a/dwds/lib/src/utilities/dart_uri.dart
+++ b/dwds/lib/src/utilities/dart_uri.dart
@@ -190,7 +190,8 @@
/// re-computing.
static String get currentDirectoryUri => _currentDirectoryUri;
- /// Record library and script uris to enable resolving library and script paths.
+ /// Record library and script uris to enable resolving library and script
+ /// paths.
static Future<void> initialize() async {
clear();
await _loadPackageConfig(
diff --git a/dwds/lib/src/utilities/server.dart b/dwds/lib/src/utilities/server.dart
index e67dfe3..776f34d 100644
--- a/dwds/lib/src/utilities/server.dart
+++ b/dwds/lib/src/utilities/server.dart
@@ -71,8 +71,8 @@
}, onError: onError);
}
-/// Throws an [wip.ExceptionDetails] object if `exceptionDetails` is present on the
-/// result.
+/// Throws an [wip.ExceptionDetails] object if `exceptionDetails` is present on
+/// the result.
void handleErrorIfPresent(wip.WipResponse? response, {String? evalContents}) {
final result = response?.result;
if (result == null) return;
@@ -85,8 +85,8 @@
}
/// Returns result contained in the response.
-/// Throws an [wip.ExceptionDetails] object if `exceptionDetails` is present on the
-/// result or the result is null.
+/// Throws an [wip.ExceptionDetails] object if `exceptionDetails` is present on
+/// the result or the result is null.
Map<String, dynamic> getResultOrHandleError(
wip.WipResponse? response, {
String? evalContents,
@@ -98,5 +98,5 @@
'text': 'null result from Chrome Devtools',
}, evalContents: evalContents);
}
- return result;
+ return result as Map<String, dynamic>;
}
diff --git a/dwds/lib/src/utilities/shared.dart b/dwds/lib/src/utilities/shared.dart
index 1a55bda..ba86664 100644
--- a/dwds/lib/src/utilities/shared.dart
+++ b/dwds/lib/src/utilities/shared.dart
@@ -19,9 +19,9 @@
void safeUnawaited(
Future<void> future, {
- void Function(dynamic, StackTrace)? onError,
+ void Function(Object, StackTrace)? onError,
}) {
- onError ??= (error, stackTrace) =>
+ onError ??= (Object error, StackTrace stackTrace) =>
_logger.warning('Error in unawaited Future:', error, stackTrace);
unawaited(future.catchError(onError));
}
@@ -35,7 +35,7 @@
String command,
Future<T> Function() asyncCallback,
) {
- return asyncCallback().catchError((error) {
+ return asyncCallback().catchError((Object error) {
return Future<T>.error(
RPCError(
command,
diff --git a/dwds/lib/src/utilities/uuid.dart b/dwds/lib/src/utilities/uuid.dart
index c2a206f..eddc45b 100644
--- a/dwds/lib/src/utilities/uuid.dart
+++ b/dwds/lib/src/utilities/uuid.dart
@@ -7,8 +7,9 @@
/// A UUID generator.
///
-/// This is a lightweight replacement for package:uuid, specifically for generating
-/// version 4 (random) UUIDs using a cryptographically secure random number generator.
+/// This is a lightweight replacement for package:uuid, specifically for
+/// generating version 4 (random) UUIDs using a cryptographically secure random
+/// number generator.
///
/// See https://datatracker.ietf.org/doc/html/rfc4122#section-4.4
/// See also https://github.com/daegalus/dart-uuid/blob/main/lib/v4.dart
@@ -21,7 +22,8 @@
///
/// The UUID is formatted as a string:
/// xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
- /// where x is a random hex digit and y is a random hex digit from 8, 9, a, or b.
+ /// where x is a random hex digit and y is a random hex digit from 8, 9, a,
+ /// or b.
String v4() {
final bytes = Uint8List(16);
for (var i = 0; i < 16; i++) {
diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml
index 9311873..b18971f 100644
--- a/dwds/pubspec.yaml
+++ b/dwds/pubspec.yaml
@@ -29,21 +29,20 @@
shelf_static: ^1.1.0
shelf_web_socket: ">=2.0.0 <4.0.0"
source_maps: ^0.10.10
+ sse: ^4.2.0
stack_trace: ^1.10.0
stream_channel: ^2.1.2
- sse: ^4.2.0
vm_service: ">=14.2.4 <16.0.0"
vm_service_interface: ^2.0.1
- web_socket_channel: ">=2.2.0 <4.0.0"
web: ^1.1.0
- webkit_inspection_protocol: ^1.0.1
web_socket: ^1.0.1
+ web_socket_channel: ">=2.2.0 <4.0.0"
+ webkit_inspection_protocol: ^1.0.1
dev_dependencies:
- analysis_config:
- path: ../_analysis_config
args: ^2.4.2
build_daemon: ^4.0.0
+ dart_flutter_team_lints: ^3.5.2
dwds_test_common:
path: ../dwds_test_common
graphs: ^2.1.0
diff --git a/dwds/test/build/ensure_version_test.dart b/dwds/test/build/ensure_version_test.dart
index b115c0b..f1bd24d 100644
--- a/dwds/test/build/ensure_version_test.dart
+++ b/dwds/test/build/ensure_version_test.dart
@@ -14,7 +14,7 @@
void main() {
test('dwds lib/src/version.dart matches the pubspec version', () {
- final pubspec = loadYaml(File('pubspec.yaml').readAsStringSync());
+ final pubspec = loadYaml(File('pubspec.yaml').readAsStringSync()) as Map;
expect(
Version.parse(packageVersion),
Version.parse(pubspec['version'] as String),
diff --git a/dwds/test/build/min_sdk_test.dart b/dwds/test/build/min_sdk_test.dart
index c441d04..9aca707 100644
--- a/dwds/test/build/min_sdk_test.dart
+++ b/dwds/test/build/min_sdk_test.dart
@@ -14,12 +14,13 @@
void main() {
test('dwds pubspec has the stable as min SDK constraint', () {
- final pubspec = loadYaml(File('pubspec.yaml').readAsStringSync());
+ final pubspec = loadYaml(File('pubspec.yaml').readAsStringSync()) as Map;
var sdkVersion = Version.parse(Platform.version.split(' ')[0]);
sdkVersion = Version(sdkVersion.major, sdkVersion.minor, 0);
final sdkConstraint = VersionConstraint.compatibleWith(sdkVersion);
- final pubspecSdkConstraint = pubspec['environment']['sdk'];
+ final environment = pubspec['environment'] as Map? ?? {};
+ final pubspecSdkConstraint = environment['sdk'];
expect(pubspecSdkConstraint, isNotNull);
final parsedConstraint = VersionConstraint.parse(
pubspecSdkConstraint as String,
diff --git a/dwds/test/frontend_server_common/asset_server.dart b/dwds/test/frontend_server_common/asset_server.dart
index f63b451..ef39ff0 100644
--- a/dwds/test/frontend_server_common/asset_server.dart
+++ b/dwds/test/frontend_server_common/asset_server.dart
@@ -173,7 +173,8 @@
_files[filePath] = Uint8List.fromList(utf8.encode(contents));
}
- /// Update the in-memory asset server with the provided source and manifest files.
+ /// Update the in-memory asset server with the provided source and manifest
+ /// files.
///
/// Returns a list of updated modules.
List<String> write(
diff --git a/dwds/test/frontend_server_common/bootstrap.dart b/dwds/test/frontend_server_common/bootstrap.dart
index 984657b..0d38392 100644
--- a/dwds/test/frontend_server_common/bootstrap.dart
+++ b/dwds/test/frontend_server_common/bootstrap.dart
@@ -117,12 +117,12 @@
/// method.
///
/// RE: Object.keys usage in app.main:
-/// This attaches the main entrypoint and hot reload functionality to the window.
-/// The app module will have a single property which contains the actual application
-/// code. The property name is based off of the entrypoint that is generated, for example
-/// the file `foo/bar/baz.dart` will generate a property named approximately
-/// `foo__bar__baz`. Rather than attempt to guess, we assume the first property of
-/// this object is the module.
+/// This attaches the main entrypoint and hot reload functionality to the
+/// window. The app module will have a single property which contains the
+/// actual application code. The property name is based off of the entrypoint
+/// that is generated, for example the file `foo/bar/baz.dart` will generate a
+/// property named approximately `foo__bar__baz`. Rather than attempt to guess,
+/// we assume the first property of this object is the module.
String generateMainModule({required String entrypoint}) {
return '''/* ENTRYPOINT_EXTENTION_MARKER */
diff --git a/dwds/test/frontend_server_common/devfs.dart b/dwds/test/frontend_server_common/devfs.dart
index 945acb7..10c5a83 100644
--- a/dwds/test/frontend_server_common/devfs.dart
+++ b/dwds/test/frontend_server_common/devfs.dart
@@ -355,7 +355,7 @@
if (lastCompiled == null) {
// Initial load.
assert(urisToMonitor.isEmpty);
- return InvalidationResult(uris: <Uri>[]);
+ return const InvalidationResult(uris: <Uri>[]);
}
final urisToScan = <Uri>[
diff --git a/dwds/test/integration/common/chrome_proxy_service_common.dart b/dwds/test/integration/common/chrome_proxy_service_common.dart
index 82552ec..e12589e 100644
--- a/dwds/test/integration/common/chrome_proxy_service_common.dart
+++ b/dwds/test/integration/common/chrome_proxy_service_common.dart
@@ -69,7 +69,7 @@
isolate = await service.getIsolate(vm.isolates!.first.id!);
scripts = await service.getScripts(isolate.id!);
mainScript = scripts.scripts!.firstWhere(
- (each) => each.uri!.contains('main.dart'),
+ (ScriptRef each) => each.uri!.contains('main.dart'),
);
});
@@ -742,11 +742,11 @@
expect(inst.count, null);
expect(inst.associations!.length, 1001);
final fifth = inst.associations![4];
- expect(fifth.key.valueAsString, '4');
- expect(fifth.value.valueAsString, '996');
+ expect((fifth.key as InstanceRef).valueAsString, '4');
+ expect((fifth.value as InstanceRef).valueAsString, '996');
final sixth = inst.associations![5];
- expect(sixth.key.valueAsString, '5');
- expect(sixth.value.valueAsString, '995');
+ expect((sixth.key as InstanceRef).valueAsString, '5');
+ expect((sixth.value as InstanceRef).valueAsString, '995');
});
test('bool', () async {
@@ -989,11 +989,11 @@
expect(inst.count, null);
expect(inst.associations!.length, 1001);
final fifth = inst.associations![4];
- expect(fifth.key.valueAsString, '4');
- expect(fifth.value.valueAsString, '996');
+ expect((fifth.key as InstanceRef).valueAsString, '4');
+ expect((fifth.value as InstanceRef).valueAsString, '996');
final sixth = inst.associations![5];
- expect(sixth.key.valueAsString, '5');
- expect(sixth.value.valueAsString, '995');
+ expect((sixth.key as InstanceRef).valueAsString, '5');
+ expect((sixth.value as InstanceRef).valueAsString, '995');
});
test('Maps with null count and offset greater than 0 are '
@@ -1014,8 +1014,8 @@
expect(inst.count, null);
expect(inst.associations!.length, 1);
final only = inst.associations![0];
- expect(only.key.valueAsString, '1000');
- expect(only.value.valueAsString, '0');
+ expect((only.key as InstanceRef).valueAsString, '1000');
+ expect((only.value as InstanceRef).valueAsString, '0');
});
test('Maps with null count are not truncated', () async {
@@ -1035,11 +1035,11 @@
expect(inst.count, null);
expect(inst.associations!.length, 1001);
final fifth = inst.associations![4];
- expect(fifth.key.valueAsString, '4');
- expect(fifth.value.valueAsString, '996');
+ expect((fifth.key as InstanceRef).valueAsString, '4');
+ expect((fifth.value as InstanceRef).valueAsString, '996');
final sixth = inst.associations![5];
- expect(sixth.key.valueAsString, '5');
- expect(sixth.value.valueAsString, '995');
+ expect((sixth.key as InstanceRef).valueAsString, '5');
+ expect((sixth.value as InstanceRef).valueAsString, '995');
});
test('Maps with offset/count are truncated', () async {
@@ -1054,11 +1054,11 @@
expect(inst.count, 7);
expect(inst.associations!.length, 7);
final fifth = inst.associations![0];
- expect(fifth.key.valueAsString, '4');
- expect(fifth.value.valueAsString, '996');
+ expect((fifth.key as InstanceRef).valueAsString, '4');
+ expect((fifth.value as InstanceRef).valueAsString, '996');
final sixth = inst.associations![1];
- expect(sixth.key.valueAsString, '5');
- expect(sixth.value.valueAsString, '995');
+ expect((sixth.key as InstanceRef).valueAsString, '5');
+ expect((sixth.value as InstanceRef).valueAsString, '995');
});
test(
@@ -1084,8 +1084,8 @@
expect(inst.count, 1);
expect(inst.associations!.length, 1);
final only = inst.associations![0];
- expect(only.key.valueAsString, '1000');
- expect(only.value.valueAsString, '0');
+ expect((only.key as InstanceRef).valueAsString, '1000');
+ expect((only.value as InstanceRef).valueAsString, '0');
},
);
@@ -1632,7 +1632,7 @@
await service.streamListen('Debug');
stream = service.onEvent('Debug');
mainScript = scripts.scripts!.firstWhere(
- (each) => each.uri!.contains('main.dart'),
+ (ScriptRef each) => each.uri!.contains('main.dart'),
);
});
@@ -1755,7 +1755,8 @@
(event) => event.kind == EventKind.kPauseException,
);
expect(event.exception, isNotNull);
- // Check that the exception stack trace has been mapped to Dart source files.
+ // Check that the exception stack trace has been mapped to Dart source
+ // files.
expect(event.exception!.valueAsString, contains('main.dart'));
final stack = await service.getStack(isolateId!);
@@ -2004,11 +2005,11 @@
final stream = service.onEvent('Debug');
final vm = await service.getVM();
final isolateId = vm.isolates!.first.id!;
- final pauseCompleter = Completer();
+ final pauseCompleter = Completer<void>();
final pauseSub = context.tabConnection.debugger.onPaused.listen((_) {
pauseCompleter.complete();
});
- final resumeCompleter = Completer();
+ final resumeCompleter = Completer<void>();
final resumeSub = context.tabConnection.debugger.onResumed.listen((_) {
resumeCompleter.complete();
});
@@ -2462,7 +2463,8 @@
);
String emitDebugEvent(String data) =>
- "\$emitDebugEvent('$extensionKind', '{ \"$eventData\": \"$data\" }');";
+ '\$emitDebugEvent("$extensionKind", '
+ '\'{"$eventData": "$data"}\');';
final size = 2;
final batch1 = List.generate(size, (int i) => 'data$i');
@@ -2479,7 +2481,7 @@
for (final data in batch1) {
await context.tabConnection.runtime.evaluate(emitDebugEvent(data));
}
- await Future.delayed(delay);
+ await Future<void>.delayed(delay);
for (final data in batch2) {
await context.tabConnection.runtime.evaluate(emitDebugEvent(data));
}
@@ -2707,7 +2709,7 @@
final _isSuccess = isA<Success>();
-TypeMatcher _libRef(uriMatcher) =>
- isA<LibraryRef>().having((l) => l.uri, 'uri', uriMatcher);
+TypeMatcher<LibraryRef> _libRef(Object? uriMatcher) =>
+ isA<LibraryRef>().having((LibraryRef l) => l.uri, 'uri', uriMatcher);
void expectEventually(Matcher expectation) {}
diff --git a/dwds/test/integration/common/hot_restart_common.dart b/dwds/test/integration/common/hot_restart_common.dart
index ca01000..580b6ed 100644
--- a/dwds/test/integration/common/hot_restart_common.dart
+++ b/dwds/test/integration/common/hot_restart_common.dart
@@ -118,7 +118,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugging: false,
),
);
@@ -146,7 +146,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugging: false,
useSse: false,
),
@@ -167,7 +167,7 @@
},
// `BuildResult`s are only ever emitted when using the build daemon.
skip: compilationMode == CompilationMode.buildDaemon ? null : true,
- timeout: Timeout.factor(2),
+ timeout: const Timeout.factor(2),
);
group('Injected client', () {
@@ -471,7 +471,7 @@
await fakeClient.callServiceExtension(hotRestart);
await logFuture;
});
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
group(
'Injected client with hot restart',
@@ -539,7 +539,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugging: false,
),
);
@@ -564,7 +564,7 @@
},
// `BuildResult`s are only ever emitted when using the build daemon.
skip: compilationMode == CompilationMode.buildDaemon ? null : true,
- timeout: Timeout.factor(2),
+ timeout: const Timeout.factor(2),
);
group('when isolates_paused_on_start is true', () {
diff --git a/dwds/test/integration/common/hot_restart_correctness_common.dart b/dwds/test/integration/common/hot_restart_correctness_common.dart
index d289bed..dc37269 100644
--- a/dwds/test/integration/common/hot_restart_correctness_common.dart
+++ b/dwds/test/integration/common/hot_restart_correctness_common.dart
@@ -138,7 +138,7 @@
await logFuture;
},
);
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
group(
'Injected client with hot restart',
@@ -179,7 +179,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugging: false,
),
);
@@ -200,7 +200,7 @@
},
// `BuildResult`s are only ever emitted when using the build daemon.
skip: compilationMode == CompilationMode.buildDaemon ? null : true,
- timeout: Timeout.factor(2),
+ timeout: const Timeout.factor(2),
);
}
diff --git a/dwds/test/integration/dart_uri_test.dart b/dwds/test/integration/dart_uri_test.dart
index 7caa083..5530801 100644
--- a/dwds/test/integration/dart_uri_test.dart
+++ b/dwds/test/integration/dart_uri_test.dart
@@ -156,8 +156,8 @@
final logs = <String>[];
void logWriter(
- level,
- message, {
+ Object? level,
+ Object? message, {
String? error,
String? loggerName,
String? stackTrace,
@@ -207,7 +207,7 @@
setUpAll(() async {
final toolConfiguration = TestToolConfiguration.withLoadStrategy(
loadStrategy: G3TestStrategy(FakeAssetReader()),
- appMetadata: TestAppMetadata.internalApp(),
+ appMetadata: const TestAppMetadata.internalApp(),
);
setGlobalsForTesting(toolConfiguration: toolConfiguration);
await DartUri.initialize();
diff --git a/dwds/test/integration/dds_port_common.dart b/dwds/test/integration/dds_port_common.dart
index 5de58e8..480f4e2 100644
--- a/dwds/test/integration/dds_port_common.dart
+++ b/dwds/test/integration/dds_port_common.dart
@@ -37,7 +37,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
ddsPort: expectedPort,
),
);
@@ -57,7 +57,7 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
ddsConfiguration: DartDevelopmentServiceConfiguration(
port: expectedPort,
),
diff --git a/dwds/test/integration/debug_service_common.dart b/dwds/test/integration/debug_service_common.dart
index 80003a8..e423ac1 100644
--- a/dwds/test/integration/debug_service_common.dart
+++ b/dwds/test/integration/debug_service_common.dart
@@ -25,9 +25,11 @@
moduleFormat: provider.ddcModuleFormat,
canaryFeatures: provider.canaryFeatures,
),
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
spawnDds: false,
- ddsConfiguration: DartDevelopmentServiceConfiguration(enable: false),
+ ddsConfiguration: const DartDevelopmentServiceConfiguration(
+ enable: false,
+ ),
),
);
});
diff --git a/dwds/test/integration/debugger_test.dart b/dwds/test/integration/debugger_test.dart
index fc78cbf..5786af3 100644
--- a/dwds/test/integration/debugger_test.dart
+++ b/dwds/test/integration/debugger_test.dart
@@ -55,7 +55,7 @@
'functionLocation': {'scriptId': '69', 'lineNumber': 88, 'columnNumber': 72},
'location': {'scriptId': '69', 'lineNumber': 37, 'columnNumber': 0},
'url': '',
- 'scopeChain': [],
+ 'scopeChain': <Map<String, dynamic>>[],
'this': {'type': 'undefined'},
});
@@ -91,7 +91,7 @@
skipLists = SkipLists(root);
debugger = await Debugger.create(
webkitDebugger,
- (_, __) {},
+ (_, _) {},
locations,
skipLists,
root,
@@ -145,10 +145,10 @@
asyncStackTrace: StackTrace({
'callFrames': [sampleAsyncFrame.json],
'parent': StackTrace({
- 'callFrames': [],
+ 'callFrames': <Map<String, dynamic>>[],
'parent': StackTrace({
'callFrames': [sampleAsyncFrame.json],
- 'parent': StackTrace({'callFrames': []}).json,
+ 'parent': StackTrace({'callFrames': <Map<String, dynamic>>[]}).json,
}).json,
}).json,
}),
@@ -176,8 +176,8 @@
group('errors', () {
setUp(() {
- // We need to provide an Isolate so that the code doesn't bail out on a null
- // check before it has a chance to throw.
+ // We need to provide an Isolate so that the code doesn't bail out on a
+ // null check before it has a chance to throw.
inspector = FakeChromeAppInspector(
webkitDebugger,
fakeIsolate: simpleIsolate,
diff --git a/dwds/test/integration/devtools_test.dart b/dwds/test/integration/devtools_test.dart
index 699499a..7926101 100644
--- a/dwds/test/integration/devtools_test.dart
+++ b/dwds/test/integration/devtools_test.dart
@@ -24,7 +24,7 @@
while (attempt-- > 0) {
final content = await context.webDriver.pageSource;
if (content.contains('hello_world')) return;
- await Future.delayed(const Duration(milliseconds: 100));
+ await Future<void>.delayed(const Duration(milliseconds: 100));
}
throw StateError('Page never initialized');
}
@@ -36,135 +36,131 @@
final context = TestContext(TestProject.test, provider);
for (final serveFromDds in [true, false]) {
- group(
- 'Injected client with DevTools served from ${serveFromDds ? 'DDS' : 'DevTools Launcher'}',
- () {
- setUp(() async {
- await context.setUp(
- debugSettings: TestDebugSettings.withDevToolsLaunch(
- context,
- serveFromDds: serveFromDds,
- ),
+ group('Injected client with DevTools served from '
+ '${serveFromDds ? 'DDS' : 'DevTools Launcher'}', () {
+ setUp(() async {
+ await context.setUp(
+ debugSettings: TestDebugSettings.withDevToolsLaunch(
+ context,
+ serveFromDds: serveFromDds,
+ ),
+ );
+ await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
+ // Wait for DevTools to actually open.
+ await Future<void>.delayed(const Duration(seconds: 2));
+ });
+
+ tearDown(() async {
+ await context.tearDown();
+ });
+
+ test('can launch devtools', () async {
+ final windows = await context.webDriver.windows.toList();
+ await context.webDriver.driver.switchTo.window(windows.last);
+ expect(await context.webDriver.pageSource, contains('DevTools'));
+ expect(await context.webDriver.currentUrl, contains('ide=Dwds'));
+ // TODO(https://github.com/dart-lang/webdev/issues/1888): Re-enable.
+ }, skip: Platform.isWindows);
+
+ test(
+ 'can not launch devtools for the same app in multiple tabs',
+ () async {
+ final appUrl = await context.webDriver.currentUrl;
+ // Open a new tab, select it, and navigate to the app
+ await context.webDriver.driver.execute(
+ "window.open('$appUrl', '_blank');",
+ [],
);
+ await Future<void>.delayed(const Duration(seconds: 2));
+ final newAppWindow = await context.webDriver.windows.last;
+ await newAppWindow.setAsActive();
+
+ // Wait for the page to be ready before trying to open DevTools
+ // again.
+ await _waitForPageReady(context);
+
+ // Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([
Keyboard.alt,
'd',
]);
- // Wait for DevTools to actually open.
- await Future.delayed(const Duration(seconds: 2));
- });
+ await Future<void>.delayed(const Duration(seconds: 2));
+ final alert = context.webDriver.driver.switchTo.alert;
+ expect(alert, isNotNull);
+ expect(
+ await alert.text,
+ contains('This app is already being debugged in a different tab'),
+ );
+ await alert.accept();
- tearDown(() async {
- await context.tearDown();
- });
-
- test('can launch devtools', () async {
- final windows = await context.webDriver.windows.toList();
- await context.webDriver.driver.switchTo.window(windows.last);
- expect(await context.webDriver.pageSource, contains('DevTools'));
- expect(await context.webDriver.currentUrl, contains('ide=Dwds'));
- // TODO(https://github.com/dart-lang/webdev/issues/1888): Re-enable.
- }, skip: Platform.isWindows);
-
- test(
- 'can not launch devtools for the same app in multiple tabs',
- () async {
- final appUrl = await context.webDriver.currentUrl;
- // Open a new tab, select it, and navigate to the app
- await context.webDriver.driver.execute(
- "window.open('$appUrl', '_blank');",
- [],
- );
- await Future.delayed(const Duration(seconds: 2));
- final newAppWindow = await context.webDriver.windows.last;
- await newAppWindow.setAsActive();
-
- // Wait for the page to be ready before trying to open DevTools again.
- await _waitForPageReady(context);
-
- // Try to open devtools and check for the alert.
- await context.webDriver.driver.keyboard.sendChord([
- Keyboard.alt,
- 'd',
- ]);
- await Future.delayed(const Duration(seconds: 2));
- final alert = context.webDriver.driver.switchTo.alert;
- expect(alert, isNotNull);
- expect(
- await alert.text,
- contains('This app is already being debugged in a different tab'),
- );
- await alert.accept();
-
- var windows = await context.webDriver.windows.toList();
- for (final window in windows) {
- if (window.id != newAppWindow.id) {
- await window.setAsActive();
- await window.close();
- }
+ var windows = await context.webDriver.windows.toList();
+ for (final window in windows) {
+ if (window.id != newAppWindow.id) {
+ await window.setAsActive();
+ await window.close();
}
+ }
- await newAppWindow.setAsActive();
- await context.webDriver.driver.keyboard.sendChord([
- Keyboard.alt,
- 'd',
- ]);
- await Future.delayed(const Duration(seconds: 2));
- windows = await context.webDriver.windows.toList();
- final devToolsWindow = windows.firstWhere(
- (window) => window != newAppWindow,
- );
- await devToolsWindow.setAsActive();
- expect(await context.webDriver.pageSource, contains('DevTools'));
- },
- skip: 'See https://github.com/dart-lang/webdev/issues/2462',
- );
+ await newAppWindow.setAsActive();
+ await context.webDriver.driver.keyboard.sendChord([
+ Keyboard.alt,
+ 'd',
+ ]);
+ await Future<void>.delayed(const Duration(seconds: 2));
+ windows = await context.webDriver.windows.toList();
+ final devToolsWindow = windows.firstWhere(
+ (Window window) => window != newAppWindow,
+ );
+ await devToolsWindow.setAsActive();
+ expect(await context.webDriver.pageSource, contains('DevTools'));
+ },
+ skip: 'See https://github.com/dart-lang/webdev/issues/2462',
+ );
- test(
- 'destroys and recreates the isolate during a page refresh',
- () async {
- // This test is the same as one in reload_test, but runs here when there
- // is a connected client (DevTools) since it can behave differently.
- // https://github.com/dart-lang/webdev/pull/901#issuecomment-586438132
- final client = context.debugConnection.vmService;
- await client.streamListen('Isolate');
- await context.makeEdits([
- (
- file: context.project.dartEntryFileName,
- originalString: 'Hello World!',
- newString: 'Bonjour le monde!',
- ),
- ]);
- await context.waitForSuccessfulBuild(propagateToBrowser: true);
+ test(
+ 'destroys and recreates the isolate during a page refresh',
+ () async {
+ // This test is the same as one in reload_test, but runs here when
+ // there is a connected client (DevTools) since it can behave
+ // differently.
+ // https://github.com/dart-lang/webdev/pull/901#issuecomment-586438132
+ final client = context.debugConnection.vmService;
+ await client.streamListen('Isolate');
+ await context.makeEdits([
+ (
+ file: context.project.dartEntryFileName,
+ originalString: 'Hello World!',
+ newString: 'Bonjour le monde!',
+ ),
+ ]);
+ await context.waitForSuccessfulBuild(propagateToBrowser: true);
- final eventsDone = expectLater(
- client.onIsolateEvent,
- emitsThrough(
- emitsInOrder([
- _hasKind(EventKind.kIsolateExit),
- _hasKind(EventKind.kIsolateStart),
- _hasKind(EventKind.kIsolateRunnable),
- ]),
- ),
- );
+ final eventsDone = expectLater(
+ client.onIsolateEvent,
+ emitsThrough(
+ emitsInOrder([
+ _hasKind(EventKind.kIsolateExit),
+ _hasKind(EventKind.kIsolateStart),
+ _hasKind(EventKind.kIsolateRunnable),
+ ]),
+ ),
+ );
- await context.webDriver.driver.refresh();
+ await context.webDriver.driver.refresh();
- await eventsDone;
- },
- skip: 'https://github.com/dart-lang/webdev/issues/1888',
- );
- },
- timeout: Timeout.factor(2),
- );
+ await eventsDone;
+ },
+ skip: 'https://github.com/dart-lang/webdev/issues/1888',
+ );
+ }, timeout: const Timeout.factor(2));
}
group('Injected client without a DevTools server', () {
setUp(() async {
await context.setUp(
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDevToolsLaunch: true,
- ddsConfiguration: DartDevelopmentServiceConfiguration(
+ ddsConfiguration: const DartDevelopmentServiceConfiguration(
serveDevTools: false,
),
),
@@ -178,7 +174,7 @@
test('gives a good error if devtools is not served', () async {
// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
- await Future.delayed(const Duration(seconds: 2));
+ await Future<void>.delayed(const Duration(seconds: 2));
final alert = context.webDriver.driver.switchTo.alert;
expect(alert, isNotNull);
expect(await alert.text, contains('--debug'));
@@ -191,7 +187,7 @@
() {
setUp(() async {
await context.setUp(
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
enableDebugExtension: true,
),
);
@@ -208,7 +204,7 @@
});
// Try to open devtools and check for the alert.
await context.webDriver.driver.keyboard.sendChord([Keyboard.alt, 'd']);
- await Future.delayed(const Duration(seconds: 2));
+ await Future<void>.delayed(const Duration(seconds: 2));
final alert = context.webDriver.driver.switchTo.alert;
expect(alert, isNotNull);
expect(await alert.text, contains('--debug'));
@@ -219,9 +215,9 @@
},
tags: ['extension'],
skip: 'https://github.com/dart-lang/webdev/issues/2114',
- timeout: Timeout.factor(2),
+ timeout: const Timeout.factor(2),
);
}
TypeMatcher<Event> _hasKind(String kind) =>
- isA<Event>().having((e) => e.kind, 'kind', kind);
+ isA<Event>().having((Event e) => e.kind, 'kind', kind);
diff --git a/dwds/test/integration/evaluate_common.dart b/dwds/test/integration/evaluate_common.dart
index 71d3fbb..cb6e962 100644
--- a/dwds/test/integration/evaluate_common.dart
+++ b/dwds/test/integration/evaluate_common.dart
@@ -58,7 +58,7 @@
line,
);
final event = await stream.firstWhere(
- (event) => event.kind == EventKind.kPauseBreakpoint,
+ (Event event) => event.kind == EventKind.kPauseBreakpoint,
);
await body(event);
} finally {
@@ -149,18 +149,28 @@
} catch (_) {}
});
- Future<void> onBreakPoint(script, bpId, body) =>
- onBp(stream, isolateId, script, bpId, body);
+ Future<void> onBreakPoint(
+ ScriptRef script,
+ String bpId,
+ Future<void> Function(Event) body,
+ ) => onBp(stream, isolateId, script, bpId, body);
- Future<Response> evaluateInFrame(frame, expr, {scope}) async =>
- await context.service.evaluateInFrame(
- isolateId,
- frame,
- expr,
- scope: scope,
- );
+ Future<Response> evaluateInFrame(
+ int frame,
+ String expr, {
+ Map<String, String>? scope,
+ }) async => await context.service.evaluateInFrame(
+ isolateId,
+ frame,
+ expr,
+ scope: scope,
+ );
- Future<InstanceRef> getInstanceRef(frame, expr, {scope}) async {
+ Future<InstanceRef> getInstanceRef(
+ int frame,
+ String expr, {
+ Map<String, String>? scope,
+ }) async {
final result = await evaluateInFrame(frame, expr, scope: scope);
expect(result, isA<InstanceRef>());
return result as InstanceRef;
@@ -170,7 +180,7 @@
await context.service.getObject(isolateId, ref.id!) as Instance;
test('with scope', () async {
- await onBreakPoint(mainScript, 'printFrame1', (event) async {
+ await onBreakPoint(mainScript, 'printFrame1', (Event event) async {
final frame = event.topFrame!.index!;
final scope = {
@@ -190,7 +200,7 @@
});
test('with large scope', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
const N = 20;
final frame = event.topFrame!.index!;
@@ -211,7 +221,7 @@
});
test('with large code scope', () async {
- await onBreakPoint(mainScript, 'printLargeScope', (event) async {
+ await onBreakPoint(mainScript, 'printLargeScope', (Event event) async {
const xN = 2;
const tN = 20;
final frame = event.topFrame!.index!;
@@ -239,7 +249,7 @@
});
test('with scope in caller frame', () async {
- await onBreakPoint(mainScript, 'printFrame1', (event) async {
+ await onBreakPoint(mainScript, 'printFrame1', (Event event) async {
final frame = event.topFrame!.index! + 1;
final scope = {
@@ -259,7 +269,9 @@
});
test('with scope and this', () async {
- await onBreakPoint(mainScript, 'toStringMainClass', (event) async {
+ await onBreakPoint(mainScript, 'toStringMainClass', (
+ Event event,
+ ) async {
final frame = event.topFrame!.index!;
final scope = {'x1': (await getInstanceRef(frame, '"cat"')).id!};
@@ -277,7 +289,7 @@
test(
'extension method scope variables can be evaluated',
() async {
- await onBreakPoint(mainScript, 'extension', (event) async {
+ await onBreakPoint(mainScript, 'extension', (Event event) async {
final stack = await context.service.getStack(isolateId);
final scope = _getFrameVariables(stack.frames!.first);
for (final p in scope.entries) {
@@ -296,7 +308,7 @@
);
test('does not crash if class metadata cannot be found', () async {
- await onBreakPoint(mainScript, 'printStream', (event) async {
+ await onBreakPoint(mainScript, 'printStream', (Event event) async {
final instanceRef = await getInstanceRef(
event.topFrame!.index!,
'stream',
@@ -308,7 +320,7 @@
});
test('local', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(event.topFrame!.index!, 'local');
expect(result, matchInstanceRef('42'));
@@ -316,7 +328,7 @@
});
test('Type does not show native JavaScript object fields', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final instanceRef = await getInstanceRef(
event.topFrame!.index!,
'Type',
@@ -342,7 +354,7 @@
test('field', () async {
await onBreakPoint(mainScript, 'printFieldFromLibraryClass', (
- event,
+ Event event,
) async {
final result = await getInstanceRef(
event.topFrame!.index!,
@@ -355,7 +367,7 @@
test('private field from another library', () async {
await onBreakPoint(mainScript, 'printFieldFromLibraryClass', (
- event,
+ Event event,
) async {
final result = await evaluateInFrame(
event.topFrame!.index!,
@@ -378,7 +390,7 @@
});
test('private field from current library', () async {
- await onBreakPoint(mainScript, 'printFieldMain', (event) async {
+ await onBreakPoint(mainScript, 'printFieldMain', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'instance._field',
@@ -390,7 +402,7 @@
test('access instance fields after evaluation', () async {
await onBreakPoint(mainScript, 'printFieldFromLibraryClass', (
- event,
+ Event event,
) async {
final instanceRef = await getInstanceRef(
event.topFrame!.index!,
@@ -407,7 +419,7 @@
});
test('global', () async {
- await onBreakPoint(mainScript, 'printGlobal', (event) async {
+ await onBreakPoint(mainScript, 'printGlobal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'testLibraryValue',
@@ -418,7 +430,7 @@
});
test('call core function', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'print(local)',
@@ -429,7 +441,7 @@
});
test('call library function with const param', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'testLibraryFunction(42)',
@@ -440,7 +452,7 @@
});
test('call library function with local param', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'testLibraryFunction(local)',
@@ -451,7 +463,7 @@
});
test('call library part function with const param', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'testLibraryPartFunction(42)',
@@ -462,7 +474,7 @@
});
test('call library part function with local param', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'testLibraryPartFunction(local)',
@@ -473,7 +485,9 @@
});
test('loop variable', () async {
- await onBreakPoint(mainScript, 'printLoopVariable', (event) async {
+ await onBreakPoint(mainScript, 'printLoopVariable', (
+ Event event,
+ ) async {
final result = await getInstanceRef(event.topFrame!.index!, 'item');
expect(result, matchInstanceRef('1'));
@@ -482,7 +496,7 @@
test('evaluate expression in _test_package/test_library', () async {
await onBreakPoint(testLibraryScript, 'testLibraryFunction', (
- event,
+ Event event,
) async {
final result = await getInstanceRef(event.topFrame!.index!, 'formal');
@@ -492,7 +506,7 @@
test('evaluate expression in a class constructor in a library', () async {
await onBreakPoint(testLibraryScript, 'testLibraryClassConstructor', (
- event,
+ Event event,
) async {
final result = await getInstanceRef(
event.topFrame!.index!,
@@ -509,7 +523,7 @@
await onBreakPoint(
testLibraryPartScript,
'testLibraryPartClassConstructor',
- (event) async {
+ (Event event) async {
final result = await getInstanceRef(
event.topFrame!.index!,
'this.field',
@@ -523,7 +537,7 @@
test('evaluate expression in caller frame', () async {
await onBreakPoint(testLibraryScript, 'testLibraryFunction', (
- event,
+ Event event,
) async {
final result = await getInstanceRef(
event.topFrame!.index! + 1,
@@ -535,7 +549,7 @@
});
test('evaluate expression in a library', () async {
- await onBreakPoint(libraryScript, 'Concatenate', (event) async {
+ await onBreakPoint(libraryScript, 'Concatenate', (Event event) async {
final result = await getInstanceRef(event.topFrame!.index!, 'a');
expect(result, matchInstanceRef('Hello'));
@@ -543,7 +557,7 @@
});
test('compilation error', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final error = await evaluateInFrame(event.topFrame!.index!, 'typo');
expect(
@@ -571,7 +585,7 @@
} catch (_) {}
final event = stream.firstWhere(
- (event) => event.kind == EventKind.kPauseInterrupted,
+ (Event event) => event.kind == EventKind.kPauseInterrupted,
);
final frame = (await event).topFrame;
if (frame != null) {
@@ -585,7 +599,8 @@
attempt,
lessThan(maxAttempts),
reason:
- 'Failed to receive and async frame error in $attempt attempts',
+ 'Failed to receive and async frame error in $attempt '
+ 'attempts',
);
await Future<void>.delayed(const Duration(milliseconds: 10));
attempt++;
@@ -602,14 +617,14 @@
// Verify we don't emit errors or warnings
// on async frame evaluations.
- output.stream.listen((event) {
+ output.stream.listen((String event) {
expect(event, isNot(contains('[WARNING]')));
expect(event, isNot(contains('[SEVERE]')));
});
});
test('module load error', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
final error = await evaluateInFrame(
event.topFrame!.index!,
'd.deferredPrintLocal()',
@@ -623,7 +638,7 @@
}, skip: 'https://github.com/dart-lang/sdk/issues/48587');
test('cannot evaluate in unsupported isolate', () async {
- await onBreakPoint(mainScript, 'printLocal', (event) async {
+ await onBreakPoint(mainScript, 'printLocal', (Event event) async {
await expectLater(
context.service.evaluateInFrame(
'bad',
@@ -653,11 +668,22 @@
tearDown(() async {});
- Future<Response> evaluate(targetId, expr, {scope}) async => await context
- .service
- .evaluate(isolateId, targetId, expr, scope: scope);
+ Future<Response> evaluate(
+ String? targetId,
+ String expr, {
+ Map<String, String>? scope,
+ }) async => await context.service.evaluate(
+ isolateId,
+ targetId!,
+ expr,
+ scope: scope,
+ );
- Future<InstanceRef> getInstanceRef(targetId, expr, {scope}) async {
+ Future<InstanceRef> getInstanceRef(
+ String? targetId,
+ String expr, {
+ Map<String, String>? scope,
+ }) async {
final result = await evaluate(targetId, expr, scope: scope);
expect(result, isA<InstanceRef>());
return result as InstanceRef;
@@ -853,7 +879,9 @@
});
test('cannot evaluate expression', () async {
- await onBp(stream, isolateId, mainScript, 'printLocal', (event) async {
+ await onBp(stream, isolateId, mainScript, 'printLocal', (
+ Event event,
+ ) async {
await expectLater(
context.service.evaluateInFrame(
isolateId,
@@ -894,7 +922,8 @@
'columnNumber': 0,
},
);
- return result.json['result']['breakpointId'];
+ final responseMap = result.json['result'] as Map<String, dynamic>;
+ return responseMap['breakpointId'] as String;
}
Matcher matchInstanceRefKind(String kind) =>
diff --git a/dwds/test/integration/evaluate_parts_common.dart b/dwds/test/integration/evaluate_parts_common.dart
index 1df6cb8..21c6155 100644
--- a/dwds/test/integration/evaluate_parts_common.dart
+++ b/dwds/test/integration/evaluate_parts_common.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library;
-
import 'package:dwds_test_common/logging.dart';
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
diff --git a/dwds/test/integration/events_amd_test.dart b/dwds/test/integration/events_amd_test.dart
index 921721f..11fbc5b 100644
--- a/dwds/test/integration/events_amd_test.dart
+++ b/dwds/test/integration/events_amd_test.dart
@@ -34,7 +34,7 @@
test('emits HTTP_REQUEST_EXCEPTION event', () async {
Future<void> throwAsyncException() async {
- await Future.delayed(const Duration(milliseconds: 100));
+ await Future<void>.delayed(const Duration(milliseconds: 100));
throw Exception('async error');
}
@@ -70,7 +70,7 @@
// Ignore the response.
final response = await request.close();
- await response.drain();
+ await response.drain<void>();
// Wait for expected events.
await events;
diff --git a/dwds/test/integration/events_common.dart b/dwds/test/integration/events_common.dart
index fe3b29c..17fe128 100644
--- a/dwds/test/integration/events_common.dart
+++ b/dwds/test/integration/events_common.dart
@@ -243,8 +243,8 @@
(event) => event.kind == EventKind.kPauseBreakpoint,
);
- // Evaluation succeeds and return ErrorRef containing compilation error,
- // so event is marked as success.
+ // Evaluation succeeds and return ErrorRef containing compilation
+ // error, so event is marked as success.
final expression = 'some-bad-expression';
await expectEventDuring(
matchesEvent(DwdsEventKind.evaluateInFrame, {
@@ -435,8 +435,8 @@
});
tearDown(() async {
- // We must resume execution in case a test left the isolate paused, but
- // error 106 is expected if the isolate is already running.
+ // We must resume execution in case a test left the isolate paused,
+ // but error 106 is expected if the isolate is already running.
try {
await service.resume(isolateId);
} on RPCError catch (e) {
@@ -476,7 +476,7 @@
},
// TODO(elliette): Re-enable (https://github.com/dart-lang/webdev/issues/1852).
skip: Platform.isWindows,
- timeout: Timeout.factor(2),
+ timeout: const Timeout.factor(2),
);
}
diff --git a/dwds/test/integration/execution_context_test.dart b/dwds/test/integration/execution_context_test.dart
index 936f5be..5ec431a 100644
--- a/dwds/test/integration/execution_context_test.dart
+++ b/dwds/test/integration/execution_context_test.dart
@@ -143,7 +143,7 @@
String command, {
Map<String, dynamic>? params,
}) {
- final id = params?['contextId'];
+ final id = params?['contextId'] as int?;
final response = super.sendCommand(command, params: params);
/// Mock stale contexts that cause the evaluation to throw.
@@ -186,7 +186,7 @@
/// Return the initial context ID from the DevToolsRequest.
Future<TestContextId> defaultContextId() async {
// Give the previous events time to propagate.
- await Future.delayed(Duration(milliseconds: 100));
+ await Future<void>.delayed(const Duration(milliseconds: 100));
return TestContextId.from(await extensionDebugger.executionContext!.id);
}
@@ -200,7 +200,7 @@
final executionContextId = extensionDebugger.executionContext!.id;
// Give it time to send the evaluate request.
- await Future.delayed(Duration(milliseconds: 100));
+ await Future<void>.delayed(const Duration(milliseconds: 100));
// Respond to the evaluate request.
_sendEvaluationResponse({
@@ -220,7 +220,7 @@
final executionContextId = extensionDebugger.executionContext!.id;
// Give it time to send the evaluate request.
- await Future.delayed(Duration(milliseconds: 100));
+ await Future<void>.delayed(const Duration(milliseconds: 100));
// Respond to the evaluate request.
_sendEvaluationResponse({
@@ -284,7 +284,7 @@
Future<ExecutionContext?> _waitForExecutionContext() async {
while (extensionDebugger.executionContext == null) {
- await Future.delayed(Duration(milliseconds: 20));
+ await Future<void>.delayed(const Duration(milliseconds: 20));
}
return extensionDebugger.executionContext;
}
diff --git a/dwds/test/integration/expression_compiler_service_common.dart b/dwds/test/integration/expression_compiler_service_common.dart
index 3d5a716..3b5482e 100644
--- a/dwds/test/integration/expression_compiler_service_common.dart
+++ b/dwds/test/integration/expression_compiler_service_common.dart
@@ -75,7 +75,7 @@
'localhost',
port,
verbose: false,
- sdkConfigurationProvider: DefaultSdkConfigurationProvider(),
+ sdkConfigurationProvider: const DefaultSdkConfigurationProvider(),
);
await service.initialize(compilerOptions);
diff --git a/dwds/test/integration/expression_evaluator_test.dart b/dwds/test/integration/expression_evaluator_test.dart
index 1ad7d3e..92a0be7 100644
--- a/dwds/test/integration/expression_evaluator_test.dart
+++ b/dwds/test/integration/expression_evaluator_test.dart
@@ -133,7 +133,10 @@
pausedController.sink.add(
DebuggerPausedEvent({
'method': '',
- 'params': {'reason': 'other', 'callFrames': []},
+ 'params': {
+ 'reason': 'other',
+ 'callFrames': <Map<String, dynamic>>[],
+ },
}),
);
diff --git a/dwds/test/integration/extension_debugger_test.dart b/dwds/test/integration/extension_debugger_test.dart
index 77f16c3..024ead4 100644
--- a/dwds/test/integration/extension_debugger_test.dart
+++ b/dwds/test/integration/extension_debugger_test.dart
@@ -12,6 +12,7 @@
import 'package:dwds/data/extension_request.dart';
import 'package:dwds/src/servers/extension_debugger.dart';
import 'package:test/test.dart';
+import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
import 'fixtures/debugger_data.dart';
import 'fixtures/fakes.dart';
@@ -39,7 +40,7 @@
'result': {'value': 3.14},
}),
);
- final resultCompleter = Completer();
+ final resultCompleter = Completer<WipResponse>();
unawaited(
extensionDebugger
.sendCommand('Runtime.evaluate', params: {'expression': '\$pi'})
@@ -47,7 +48,10 @@
);
connection.controllerIncoming.sink.add(jsonEncode(extensionResponse));
final response = await resultCompleter.future;
- expect(response.result['result']['value'], 3.14);
+ expect(
+ (response.result!['result'] as Map<String, dynamic>)['value'],
+ 3.14,
+ );
});
test('an ExtensionEvent', () async {
@@ -102,7 +106,7 @@
final decoded = jsonDecode(
await connection.controllerOutgoing.stream.first,
);
- final request = ExtensionRequest.fromJson(decoded);
+ final request = ExtensionRequest.fromJson(decoded as List<dynamic>);
expect(request, extensionRequest);
});
@@ -121,7 +125,7 @@
final decoded = jsonDecode(
await connection.controllerOutgoing.stream.first,
);
- final request = ExtensionRequest.fromJson(decoded);
+ final request = ExtensionRequest.fromJson(decoded as List<dynamic>);
expect(request, extensionRequest);
});
});
diff --git a/dwds/test/integration/fixtures/context.dart b/dwds/test/integration/fixtures/context.dart
index be71d4a..ebf7bb6 100644
--- a/dwds/test/integration/fixtures/context.dart
+++ b/dwds/test/integration/fixtures/context.dart
@@ -54,13 +54,16 @@
final Matcher throwsRPCError = throwsA(isRPCError);
final Matcher throwsSentinelException = throwsA(isSentinelException);
-Matcher isRPCErrorWithMessage(String message) =>
- isA<RPCError>().having((e) => e.message, 'message', contains(message));
+Matcher isRPCErrorWithMessage(String message) => isA<RPCError>().having(
+ (RPCError e) => e.message,
+ 'message',
+ contains(message),
+);
Matcher throwsRPCErrorWithMessage(String message) =>
throwsA(isRPCErrorWithMessage(message));
Matcher isRPCErrorWithCode(int code) =>
- isA<RPCError>().having((e) => e.code, 'code', equals(code));
+ isA<RPCError>().having((RPCError e) => e.code, 'code', equals(code));
Matcher throwsRPCErrorWithCode(int code) => throwsA(isRPCErrorWithCode(code));
enum CompilationMode {
@@ -137,8 +140,8 @@
/// Internal VM service.
///
- /// Prefer using [vmService] instead in tests when possible, to include testing
- /// of the VmServerConnection (bypassed when using [service]).
+ /// Prefer using [vmService] instead in tests when possible, to include
+ /// testing of the VmServerConnection (bypassed when using [service]).
ChromeProxyService get service => fetchChromeProxyService(debugConnection);
/// External VM service.
@@ -217,7 +220,7 @@
// We therefore wait until ChromeDriver reports that it has started
// successfully.
- final chromeDriverStartup = Completer();
+ final chromeDriverStartup = Completer<void>();
stdOutLines.listen((line) {
if (!chromeDriverStartup.isCompleted &&
line.contains('was started successfully')) {
@@ -375,7 +378,7 @@
final entry = p.toUri(
p.join(project.webAssetsPath, project.dartEntryFileName),
);
- frontendServerFileSystem = LocalFileSystem();
+ frontendServerFileSystem = const LocalFileSystem();
final packageUriMapper = await PackageUriMapper.create(
frontendServerFileSystem,
project.packageConfigFile,
@@ -446,7 +449,8 @@
buildSettings,
).strategy,
_ => throw Exception(
- 'Unsupported DDC module format ${testSettings.moduleFormat.name}.',
+ 'Unsupported DDC module format '
+ '${testSettings.moduleFormat.name}.',
),
};
buildResults = const Stream<BuildResults>.empty();
@@ -472,7 +476,8 @@
'--define',
'build_web_compilers|entrypoint_marker=web-hot-reload=true',
'--define',
- 'build_web_compilers|entrypoint_marker=web-assets-path=${project.webAssetsPath}',
+ 'build_web_compilers|entrypoint_marker=web-assets-path='
+ '${project.webAssetsPath}',
'--define',
'build_web_compilers|ddc=web-hot-reload=true',
'--define',
@@ -520,7 +525,7 @@
);
expressionCompiler = ddcService;
}
- frontendServerFileSystem = LocalFileSystem();
+ frontendServerFileSystem = const LocalFileSystem();
final packageUriMapper = await PackageUriMapper.create(
frontendServerFileSystem,
project.packageConfigFile,
@@ -588,8 +593,8 @@
// The debugger tab must be enabled and connected before certain
// listeners in DWDS or `main` is run.
- final tabConnectionCompleter = Completer();
- final appConnectionCompleter = Completer();
+ final tabConnectionCompleter = Completer<void>();
+ final appConnectionCompleter = Completer<void>();
final connection = ChromeConnection('localhost', debugPort);
// TODO(srujzs): In the case of the frontend server, it doesn't make sense
@@ -739,7 +744,9 @@
// timestamp that is guaranteed to be after the previous compile.
// TODO(https://github.com/dart-lang/sdk/issues/51937): Remove once this bug
// is fixed.
- if (Platform.isWindows) await Future.delayed(Duration(seconds: 1));
+ if (Platform.isWindows) {
+ await Future<void>.delayed(const Duration(seconds: 1));
+ }
_reloadedSources.clear();
for (var (:file, :originalString, :newString) in edits) {
if (file == project.dartEntryFileName) {
@@ -764,7 +771,7 @@
/// - Entrypoints (served): web/main.dart -> main
/// - Entrypoints (nested): test/hello_world/main.dart -> hello_world/main
/// - Library files: lib/path/to/some_file.dart
- /// -> packages/[package]/path/to/some_file
+ /// -> packages/`package`/path/to/some_file
void _updateReloadedSources(String absolutePath) {
final relativePath = p.relative(
absolutePath,
@@ -869,8 +876,8 @@
// Wait for the build until the timeout is reached:
await daemonClient.buildResults
.firstWhere(
- (results) => results.results.any(
- (result) => result.status == BuildStatus.succeeded,
+ (BuildResults results) => results.results.any(
+ (BuildResult result) => result.status == BuildStatus.succeeded,
),
)
.timeout(timeout ?? const Duration(seconds: 60));
@@ -882,7 +889,7 @@
final delay = Platform.isWindows
? const Duration(seconds: 5)
: const Duration(seconds: 2);
- await Future.delayed(delay);
+ await Future<void>.delayed(delay);
}
}
diff --git a/dwds/test/integration/fixtures/debugger_data.dart b/dwds/test/integration/fixtures/debugger_data.dart
index 5b20226..04768bc 100644
--- a/dwds/test/integration/fixtures/debugger_data.dart
+++ b/dwds/test/integration/fixtures/debugger_data.dart
@@ -92,10 +92,10 @@
/// elements of a scope chain.
///
/// It has two variables named 'a' and 'b' in the first scope.
-var variables1 = [
+List<WipResponse> variables1 = [
WipResponse({
'id': 1,
- 'result': {'result': []},
+ 'result': {'result': <Map<String, dynamic>>[]},
}),
WipResponse({
'id': 2,
@@ -114,7 +114,7 @@
}),
WipResponse({
'id': 3,
- 'result': {'result': []},
+ 'result': {'result': <Map<String, dynamic>>[]},
}),
// Fake that the SDK is loaded.
WipResponse({
@@ -128,16 +128,16 @@
}),
WipResponse({
'id': 5,
- 'result': {'result': []},
+ 'result': {'result': <Map<String, dynamic>>[]},
}),
WipResponse({
'id': 6,
- 'result': {'result': []},
+ 'result': {'result': <Map<String, dynamic>>[]},
}),
];
/// Sample data for a Debugger.scriptParsed event
-var scriptParsedParams = {
+Map<String, Object> scriptParsedParams = {
"endColumn": 0,
"endLine": 53,
"executionContextAuxData": {
diff --git a/dwds/test/integration/fixtures/fakes.dart b/dwds/test/integration/fixtures/fakes.dart
index 219becb..2a5f00a 100644
--- a/dwds/test/integration/fixtures/fakes.dart
+++ b/dwds/test/integration/fixtures/fakes.dart
@@ -80,9 +80,9 @@
'Runtime.getProperties',
params: {'objectId': objectId, 'ownProperties': true},
);
- final result = response.result?['result'];
+ final result = response.result?['result'] as List<dynamic>? ?? [];
return result
- .map<Property>((each) => Property(each as Map<String, dynamic>))
+ .map<Property>((Object? each) => Property(each as Map<String, dynamic>))
.toList();
}
@@ -212,9 +212,9 @@
ReloadConfiguration.none,
(_) async => {},
(_) async => {},
- (_, __) async => null,
- (MetadataProvider _, String __) async => '',
- (MetadataProvider _, String __) async => '',
+ (_, _) async => null,
+ (MetadataProvider _, String _) async => '',
+ (MetadataProvider _, String _) async => '',
(String _) => '',
(MetadataProvider _) async => <String, ModuleInfo>{},
FakeAssetReader(),
@@ -234,19 +234,20 @@
Stream<WipDomain>? get onClosed => null;
@override
- Stream<GlobalObjectClearedEvent> get onGlobalObjectCleared => Stream.empty();
+ Stream<GlobalObjectClearedEvent> get onGlobalObjectCleared =>
+ const Stream.empty();
@override
late Stream<DebuggerPausedEvent> onPaused;
@override
- Stream<DebuggerResumedEvent> get onResumed => Stream.empty();
+ Stream<DebuggerResumedEvent> get onResumed => const Stream.empty();
@override
- Stream<ScriptParsedEvent> get onScriptParsed => Stream.empty();
+ Stream<ScriptParsedEvent> get onScriptParsed => const Stream.empty();
@override
- Stream<TargetCrashedEvent> get onTargetCrashed => Stream.empty();
+ Stream<TargetCrashedEvent> get onTargetCrashed => const Stream.empty();
@override
Future<WipResponse> pause() async => fakeWipResponse;
@@ -292,16 +293,16 @@
fakeWipResponse;
@override
- Stream<ConsoleAPIEvent> get onConsoleAPICalled => Stream.empty();
+ Stream<ConsoleAPIEvent> get onConsoleAPICalled => const Stream.empty();
@override
- Stream<ExceptionThrownEvent> get onExceptionThrown => Stream.empty();
+ Stream<ExceptionThrownEvent> get onExceptionThrown => const Stream.empty();
@override
Future<void> close() async {}
@override
- Stream<WipConnection> get onClose => Stream.empty();
+ Stream<WipConnection> get onClose => const Stream.empty();
@override
Future<RemoteObject> evaluate(
@@ -427,7 +428,7 @@
String? metadata;
final String? _dartSource;
final String? _sourceMap;
- FakeAssetReader({this.metadata, dartSource, sourceMap})
+ FakeAssetReader({this.metadata, String? dartSource, String? sourceMap})
: _dartSource = dartSource,
_sourceMap = sourceMap;
diff --git a/dwds/test/integration/fixtures/project.dart b/dwds/test/integration/fixtures/project.dart
index 553946d..992bb83 100644
--- a/dwds/test/integration/fixtures/project.dart
+++ b/dwds/test/integration/fixtures/project.dart
@@ -203,9 +203,9 @@
Directory(newPath).createSync();
copyPathSync(currentPath, newPath);
copiedPackageDirectories.add(packageDirectory);
- final pubspec = loadYaml(
- File(p.join(currentPath, 'pubspec.yaml')).readAsStringSync(),
- );
+ final pubspec =
+ loadYaml(File(p.join(currentPath, 'pubspec.yaml')).readAsStringSync())
+ as Map;
final dependencies = pubspec['dependencies'] as Map? ?? {};
for (final dependency in dependencies.values) {
if (dependency is Map && dependency.containsKey('path')) {
@@ -271,7 +271,7 @@
_fixturesCopy.deleteSync(recursive: true);
break;
} on FileSystemException catch (_) {
- await Future.delayed(Duration(seconds: seconds));
+ await Future<void>.delayed(Duration(seconds: seconds));
seconds *= 2;
}
}
diff --git a/dwds/test/integration/fixtures/utilities.dart b/dwds/test/integration/fixtures/utilities.dart
index bccc8f3..99f2f25 100644
--- a/dwds/test/integration/fixtures/utilities.dart
+++ b/dwds/test/integration/fixtures/utilities.dart
@@ -21,7 +21,7 @@
String dartPath,
String workingDirectory,
List<String> options,
- Function(ServerLog) logHandler,
+ void Function(ServerLog) logHandler,
) => BuildDaemonClient.connect(workingDirectory, [
dartPath,
'run',
@@ -55,7 +55,7 @@
throw Exception(failureMessage);
}
- await Future.delayed(Duration(milliseconds: delayInMs));
+ await Future<void>.delayed(Duration(milliseconds: delayInMs));
try {
final result = callback();
if (expectedResult != null && result == expectedResult) return result;
@@ -84,7 +84,7 @@
throw Exception(failureMessage);
}
- await Future.delayed(Duration(milliseconds: delayInMs));
+ await Future<void>.delayed(Duration(milliseconds: delayInMs));
try {
final result = await callback();
if (result != null) return result;
@@ -311,7 +311,7 @@
class TestCompilerOptions extends CompilerOptions {
TestCompilerOptions({
required super.canaryFeatures,
- super.experiments = const [],
+ super.experiments = const <String>[],
super.moduleFormat = ModuleFormat.amd,
});
}
diff --git a/dwds/test/integration/handlers/injector_test.dart b/dwds/test/integration/handlers/injector_test.dart
index 1d87d16..b791dea 100644
--- a/dwds/test/integration/handlers/injector_test.dart
+++ b/dwds/test/integration/handlers/injector_test.dart
@@ -311,7 +311,7 @@
late DwdsInjector injector;
setUp(() async {
final toolConfiguration = TestToolConfiguration.withDefaultLoadStrategy(
- debugSettings: TestDebugSettings.noDevToolsLaunch().copyWith(
+ debugSettings: const TestDebugSettings.noDevToolsLaunch().copyWith(
useSse: false,
),
);
diff --git a/dwds/test/integration/hot_reload_breakpoints_common.dart b/dwds/test/integration/hot_reload_breakpoints_common.dart
index 7f417d3..276781b 100644
--- a/dwds/test/integration/hot_reload_breakpoints_common.dart
+++ b/dwds/test/integration/hot_reload_breakpoints_common.dart
@@ -511,7 +511,7 @@
// the old string still as the closure has not been reevaluated.
await callEvaluateAndWaitForLog(oldCapturedString);
});
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
group('when pause_isolates_on_start is false', () {
late VmService client;
@@ -578,7 +578,7 @@
// Program should not be paused, so this should execute.
await callEvaluateAndWaitForLog(newString);
});
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
}
TypeMatcher<Event> _hasKind(String kind) =>
diff --git a/dwds/test/integration/hot_reload_common.dart b/dwds/test/integration/hot_reload_common.dart
index 696cba6..ebb780e 100644
--- a/dwds/test/integration/hot_reload_common.dart
+++ b/dwds/test/integration/hot_reload_common.dart
@@ -122,5 +122,5 @@
await callEvaluateAndWaitForLog(newString);
});
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
}
diff --git a/dwds/test/integration/hot_restart_breakpoints_common.dart b/dwds/test/integration/hot_restart_breakpoints_common.dart
index feda92c..e9991c5 100644
--- a/dwds/test/integration/hot_restart_breakpoints_common.dart
+++ b/dwds/test/integration/hot_restart_breakpoints_common.dart
@@ -326,7 +326,8 @@
final newLog = "log('\$libraryValue');";
edits.add((file: mainFile, originalString: oldLog, newString: newLog));
- // Include library file in edits to ensure it's added to reloaded_sources.json
+ // Include library file in edits to ensure it's added to
+ // reloaded_sources.json
edits.add((
file: libFile,
originalString: 'String get libraryValue',
@@ -390,7 +391,8 @@
final newLog = "log('\$libraryValue$numFiles');";
edits.add((file: mainFile, originalString: oldLog, newString: newLog));
- // Include library files in edits to ensure they are added to reloaded_sources.json
+ // Include library files in edits to ensure they are added to
+ // reloaded_sources.json
for (var i = 1; i <= numFiles; i++) {
edits.add((
file: 'library$i.dart',
diff --git a/dwds/test/integration/instances/common/class_inspection_common.dart b/dwds/test/integration/instances/common/class_inspection_common.dart
index 1e857dd..2c09d9d 100644
--- a/dwds/test/integration/instances/common/class_inspection_common.dart
+++ b/dwds/test/integration/instances/common/class_inspection_common.dart
@@ -11,7 +11,6 @@
import 'package:dwds_test_common/test_sdk_configuration.dart';
import 'package:test/test.dart';
import 'package:vm_service/vm_service.dart';
-
import '../../fixtures/context.dart';
import '../../fixtures/project.dart';
import '../../fixtures/utilities.dart';
@@ -30,7 +29,10 @@
late String isolateId;
late ScriptRef mainScript;
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -38,7 +40,8 @@
body,
);
- Future<Obj> getObject(instanceId) => service.getObject(isolateId, instanceId);
+ Future<Obj> getObject(String instanceId) =>
+ service.getObject(isolateId, instanceId);
group('$compilationMode |', () {
setUpAll(() async {
@@ -76,7 +79,7 @@
group('calling getObject for an existent class', () {
test('returns the correct class representation', () async {
- await onBreakPoint('testClass1Case1', (event) async {
+ await onBreakPoint('testClass1Case1', (Event event) async {
// classes|dart:core|Object_Diagnosticable
final result = await getObject(
'classes|org-dartlang-app:///web/main.dart|GreeterClass',
@@ -100,7 +103,7 @@
// should throw an error in this case for the client to catch instead
// of returning an empty class.
test('returns an empty class representation', () async {
- await onBreakPoint('testClass1Case1', (event) async {
+ await onBreakPoint('testClass1Case1', (Event event) async {
final result = await getObject(
'classes|dart:core|Object_Diagnosticable',
);
diff --git a/dwds/test/integration/instances/common/dot_shorthands_common.dart b/dwds/test/integration/instances/common/dot_shorthands_common.dart
index e7e037f..f37bd6f 100644
--- a/dwds/test/integration/instances/common/dot_shorthands_common.dart
+++ b/dwds/test/integration/instances/common/dot_shorthands_common.dart
@@ -37,7 +37,7 @@
body,
);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
group('$compilationMode | dot shorthands:', () {
@@ -72,7 +72,7 @@
});
test('expression evaluation', () async {
- final bp = onBreakpoint('testDotShorthands', (event) async {
+ final bp = onBreakpoint('testDotShorthands', (Event event) async {
final frame = event.topFrame!.index!;
var instanceRef = await getInstanceRef(frame, '(c = .two).value');
@@ -96,7 +96,7 @@
});
test('single-stepping', () async {
- final bp = onBreakpoint('testDotShorthands', (event) async {
+ final bp = onBreakpoint('testDotShorthands', (Event event) async {
final scriptBasename = basename(mainScript.uri!);
const lineA = 9;
diff --git a/dwds/test/integration/instances/common/instance_common.dart b/dwds/test/integration/instances/common/instance_common.dart
index 5c284ec..16575c1 100644
--- a/dwds/test/integration/instances/common/instance_common.dart
+++ b/dwds/test/integration/instances/common/instance_common.dart
@@ -136,8 +136,8 @@
final unsupportedTestMsg =
'This test is not supported with the DDC Library '
- "Bundle Format because the dartDevEmbedder doesn't let you access compiled "
- 'constructors at runtime.';
+ "Bundle Format because the dartDevEmbedder doesn't let you access "
+ 'compiled constructors at runtime.';
group('instanceRef', () {
setUp(() => setCurrentLogWriter(debug: provider.verbose));
@@ -389,7 +389,7 @@
final classRef = instance.classRef!;
expect(classRef, isNotNull);
expect(classRef.name, matchListClassName('String'));
- final first = instance.elements![0];
+ final first = instance.elements![0] as InstanceRef;
expect(first.valueAsString, 'library');
expect(inspector.isDisplayableObject(instance), isTrue);
});
@@ -415,7 +415,7 @@
expect(instance!.kind, InstanceKind.kMap);
final classRef = instance.classRef!;
expect(classRef.name, 'IdentityMap<String, int>');
- final first = instance.associations![0].value;
+ final first = instance.associations![0].value as InstanceRef;
expect(first.valueAsString, '1');
expect(inspector.isDisplayableObject(instance), isTrue);
});
diff --git a/dwds/test/integration/instances/common/instance_inspection_common.dart b/dwds/test/integration/instances/common/instance_inspection_common.dart
index b2c933e..13f9126 100644
--- a/dwds/test/integration/instances/common/instance_inspection_common.dart
+++ b/dwds/test/integration/instances/common/instance_inspection_common.dart
@@ -27,7 +27,10 @@
final testInspector = TestInspector(context);
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -35,21 +38,25 @@
body,
);
- Future<Instance> getInstance(frame, expression) =>
+ Future<Instance> getInstance(int frame, String expression) =>
testInspector.getInstance(isolateId, frame, expression);
- Future<Obj> getObject(instanceId) => service.getObject(isolateId, instanceId);
+ Future<Obj> getObject(String instanceId) =>
+ service.getObject(isolateId, instanceId);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
- Future<Map<Object?, Object?>> getFields(instanceRef, {offset, count}) =>
- testInspector.getFields(
- isolateId,
- instanceRef,
- offset: offset,
- count: count,
- );
+ Future<Map<Object?, Object?>> getFields(
+ InstanceRef instanceRef, {
+ int? offset,
+ int? count,
+ }) => testInspector.getFields(
+ isolateId,
+ instanceRef,
+ offset: offset,
+ count: count,
+ );
group('$compilationMode |', () {
setUpAll(() async {
@@ -120,7 +127,7 @@
group('Object |', () {
test('type and fields', () async {
- await onBreakPoint('printFieldMain', (event) async {
+ await onBreakPoint('printFieldMain', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'instance');
@@ -167,7 +174,7 @@
});
test('field access', () async {
- await onBreakPoint('printFieldMain', (event) async {
+ await onBreakPoint('printFieldMain', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'instance.field'),
@@ -184,7 +191,7 @@
group('List |', () {
test('type and fields', () async {
- await onBreakPoint('printList', (event) async {
+ await onBreakPoint('printList', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'list');
@@ -192,7 +199,10 @@
expect(await getObject(instanceId), matchListInstance(type: 'int'));
expect(await getFields(instanceRef), {0: 0.0, 1: 1.0, 2: 2.0});
- expect(await getFields(instanceRef, offset: 1, count: 0), {});
+ expect(
+ await getFields(instanceRef, offset: 1, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0), {
0: 0.0,
1: 1.0,
@@ -205,12 +215,15 @@
0: 1.0,
1: 2.0,
});
- expect(await getFields(instanceRef, offset: 3, count: 3), {});
+ expect(
+ await getFields(instanceRef, offset: 3, count: 3),
+ <Object?, Object?>{},
+ );
});
});
test('Element access', () async {
- await onBreakPoint('printList', (event) async {
+ await onBreakPoint('printList', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'list[0]'),
@@ -232,7 +245,7 @@
group('Map |', () {
test('type and fields', () async {
- await onBreakPoint('printMap', (event) async {
+ await onBreakPoint('printMap', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'map');
@@ -244,7 +257,10 @@
expect(await getFields(instanceRef), {'a': 1, 'b': 2, 'c': 3});
- expect(await getFields(instanceRef, offset: 1, count: 0), {});
+ expect(
+ await getFields(instanceRef, offset: 1, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0), {
'a': 1,
'b': 2,
@@ -257,12 +273,15 @@
'b': 2,
'c': 3,
});
- expect(await getFields(instanceRef, offset: 3, count: 3), {});
+ expect(
+ await getFields(instanceRef, offset: 3, count: 3),
+ <Object?, Object?>{},
+ );
});
});
test('Element access', () async {
- await onBreakPoint('printMap', (event) async {
+ await onBreakPoint('printMap', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r"map['a']"),
@@ -284,7 +303,7 @@
group('Set |', () {
test('type and fields', () async {
- await onBreakPoint('printSet', (event) async {
+ await onBreakPoint('printSet', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'mySet');
@@ -315,13 +334,19 @@
0: 5.0,
1: 7.0,
});
- expect(await getFields(instanceRef, offset: 1, count: 0), {});
- expect(await getFields(instanceRef, offset: 10, count: 2), {});
+ expect(
+ await getFields(instanceRef, offset: 1, count: 0),
+ <Object?, Object?>{},
+ );
+ expect(
+ await getFields(instanceRef, offset: 10, count: 2),
+ <Object?, Object?>{},
+ );
});
});
test('Element access', () async {
- await onBreakPoint('printSet', (event) async {
+ await onBreakPoint('printSet', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'mySet.first'),
diff --git a/dwds/test/integration/instances/common/patterns_inspection_common.dart b/dwds/test/integration/instances/common/patterns_inspection_common.dart
index 9ac940d..8255c56 100644
--- a/dwds/test/integration/instances/common/patterns_inspection_common.dart
+++ b/dwds/test/integration/instances/common/patterns_inspection_common.dart
@@ -25,7 +25,10 @@
late String isolateId;
late ScriptRef mainScript;
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -33,16 +36,19 @@
body,
);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
- Future<Map<Object?, Object?>> getFields(instanceRef, {offset, count}) =>
- testInspector.getFields(
- isolateId,
- instanceRef,
- offset: offset,
- count: count,
- );
+ Future<Map<Object?, Object?>> getFields(
+ InstanceRef instanceRef, {
+ int? offset,
+ int? count,
+ }) => testInspector.getFields(
+ isolateId,
+ instanceRef,
+ offset: offset,
+ count: count,
+ );
Future<Map<String?, Instance?>> getFrameVariables(Frame frame) =>
testInspector.getFrameVariables(isolateId, frame);
diff --git a/dwds/test/integration/instances/common/record_inspection_common.dart b/dwds/test/integration/instances/common/record_inspection_common.dart
index f4ed96d..ef4c65c 100644
--- a/dwds/test/integration/instances/common/record_inspection_common.dart
+++ b/dwds/test/integration/instances/common/record_inspection_common.dart
@@ -25,7 +25,10 @@
late String isolateId;
late ScriptRef mainScript;
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -33,19 +36,20 @@
body,
);
- Future<Instance> getInstance(frame, expression) =>
+ Future<Instance> getInstance(int frame, String expression) =>
testInspector.getInstance(isolateId, frame, expression);
- Future<Obj> getObject(instanceId) => service.getObject(isolateId, instanceId);
+ Future<Obj> getObject(String instanceId) =>
+ service.getObject(isolateId, instanceId);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
Future<Map<Object?, Object?>> getFields(
- instanceRef, {
- offset,
- count,
- depth = -1,
+ InstanceRef instanceRef, {
+ int? offset,
+ int? count,
+ int depth = -1,
}) => testInspector.getFields(
isolateId,
instanceRef,
@@ -89,11 +93,11 @@
tearDown(() => service.resume(isolateId));
test('simple record display', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -111,7 +115,7 @@
});
test('simple records', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
final instanceId = instanceRef.id!;
@@ -122,8 +126,11 @@
expect(await getFields(instanceRef), {1: true, 2: 3});
expect(await getFields(instanceRef, offset: 0), {1: true, 2: 3});
expect(await getFields(instanceRef, offset: 1), {2: 3});
- expect(await getFields(instanceRef, offset: 2), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 2), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -133,12 +140,15 @@
1: true,
2: 3,
});
- expect(await getFields(instanceRef, offset: 2, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 2, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('simple records, field access', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'record.$1'),
@@ -153,11 +163,11 @@
});
test('simple records with named fields display', () async {
- await onBreakPoint('printSimpleNamedLocalRecord', (event) async {
+ await onBreakPoint('printSimpleNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -175,7 +185,7 @@
});
test('simple records with named fields', () async {
- await onBreakPoint('printSimpleNamedLocalRecord', (event) async {
+ await onBreakPoint('printSimpleNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
@@ -189,8 +199,11 @@
'cat': 'Vasya',
});
expect(await getFields(instanceRef, offset: 1), {'cat': 'Vasya'});
- expect(await getFields(instanceRef, offset: 2), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 2), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -200,12 +213,15 @@
1: true,
'cat': 'Vasya',
});
- expect(await getFields(instanceRef, offset: 2, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 2, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('simple records with named fields, field access', () async {
- await onBreakPoint('printSimpleNamedLocalRecord', (event) async {
+ await onBreakPoint('printSimpleNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'record.$1'),
@@ -220,11 +236,11 @@
});
test('complex records display', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -242,7 +258,7 @@
});
test('complex records', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
@@ -272,8 +288,11 @@
expect(await getFields(instanceRef, offset: 2), {
3: {'a': 1, 'b': 5},
});
- expect(await getFields(instanceRef, offset: 3), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 3), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -284,12 +303,15 @@
2: 3,
3: {'a': 1, 'b': 5},
});
- expect(await getFields(instanceRef, offset: 3, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 3, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('complex records, field access', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'record.$1'),
@@ -308,11 +330,11 @@
});
test('complex records with named fields display', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -330,7 +352,7 @@
});
test('complex records with named fields', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
@@ -360,8 +382,11 @@
expect(await getFields(instanceRef, offset: 2), {
'array': {'a': 1, 'b': 5},
});
- expect(await getFields(instanceRef, offset: 3), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 3), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -372,12 +397,15 @@
2: 3,
'array': {'a': 1, 'b': 5},
});
- expect(await getFields(instanceRef, offset: 3, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 3, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('complex records with named fields, field access', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
expect(
await getInstance(frame, r'record.$1'),
@@ -396,11 +424,11 @@
});
test('nested records display', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -418,7 +446,7 @@
});
test('nested records', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
@@ -437,8 +465,11 @@
expect(await getFields(instanceRef, offset: 1), {
2: {1: false, 2: 5},
});
- expect(await getFields(instanceRef, offset: 2), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 2), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -448,12 +479,15 @@
1: true,
2: {1: false, 2: 5},
});
- expect(await getFields(instanceRef, offset: 2, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 2, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('nested records, field access', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, r'record.$2');
@@ -467,11 +501,11 @@
});
test('nested records with named fields display', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordClass);
@@ -489,7 +523,7 @@
});
test('nested records with named fields', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record');
@@ -514,8 +548,11 @@
expect(await getFields(instanceRef, offset: 1, count: 2), {
'inner': {1: false, 2: 5},
});
- expect(await getFields(instanceRef, offset: 2), {});
- expect(await getFields(instanceRef, offset: 0, count: 0), {});
+ expect(await getFields(instanceRef, offset: 2), <Object?, Object?>{});
+ expect(
+ await getFields(instanceRef, offset: 0, count: 0),
+ <Object?, Object?>{},
+ );
expect(await getFields(instanceRef, offset: 0, count: 1), {1: true});
expect(await getFields(instanceRef, offset: 0, count: 2), {
1: true,
@@ -525,12 +562,15 @@
1: true,
'inner': {1: false, 2: 5},
});
- expect(await getFields(instanceRef, offset: 2, count: 5), {});
+ expect(
+ await getFields(instanceRef, offset: 2, count: 5),
+ <Object?, Object?>{},
+ );
});
});
test('nested records with named fields, field access', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, r'record.inner');
diff --git a/dwds/test/integration/instances/common/record_type_inspection_common.dart b/dwds/test/integration/instances/common/record_type_inspection_common.dart
index 02f4bfc..82eb5c3 100644
--- a/dwds/test/integration/instances/common/record_type_inspection_common.dart
+++ b/dwds/test/integration/instances/common/record_type_inspection_common.dart
@@ -25,7 +25,10 @@
late String isolateId;
late ScriptRef mainScript;
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -33,9 +36,10 @@
body,
);
- Future<Obj> getObject(instanceId) => service.getObject(isolateId, instanceId);
+ Future<Obj> getObject(String instanceId) =>
+ service.getObject(isolateId, instanceId);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
Future<Map<Object?, String?>> getDisplayedFields(InstanceRef ref) =>
@@ -95,13 +99,13 @@
expect(instanceRef, matchRecordTypeInstanceRef(length: 2));
expect(await getObject(instanceId), matchRecordTypeInstance(length: 2));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
});
});
test('simple record type elements', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -115,7 +119,7 @@
});
test('simple record type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
@@ -127,7 +131,7 @@
});
test('simple record type display', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final typeStringRef = await getInstanceRef(
frame,
@@ -146,7 +150,7 @@
});
test('complex record type', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -154,13 +158,13 @@
expect(instanceRef, matchRecordTypeInstanceRef(length: 3));
expect(await getObject(instanceId), matchRecordTypeInstance(length: 3));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
});
});
test('complex record type elements', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -179,7 +183,7 @@
});
test('complex record type getters', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
@@ -191,7 +195,7 @@
});
test('complex record type display', () async {
- await onBreakPoint('printComplexLocalRecord', (event) async {
+ await onBreakPoint('printComplexLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final typeStringRef = await getInstanceRef(
frame,
@@ -210,7 +214,7 @@
});
test('complex record type with named fields ', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -218,13 +222,13 @@
expect(instanceRef, matchRecordTypeInstanceRef(length: 3));
expect(await getObject(instanceId), matchRecordTypeInstance(length: 3));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
});
});
test('complex record type with named fields elements', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -244,7 +248,7 @@
});
test('complex record type with named fields getters', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
@@ -256,7 +260,7 @@
});
test('complex record type with named fields display', () async {
- await onBreakPoint('printComplexNamedLocalRecord', (event) async {
+ await onBreakPoint('printComplexNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final typeStringRef = await getInstanceRef(
frame,
@@ -275,7 +279,7 @@
});
test('nested record type', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -283,13 +287,13 @@
expect(instanceRef, matchRecordTypeInstanceRef(length: 2));
expect(await getObject(instanceId), matchRecordTypeInstance(length: 2));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
});
});
test('nested record type elements', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -312,7 +316,7 @@
});
test('nested record type getters', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final elements = await getElements(instanceRef.id!);
@@ -329,7 +333,7 @@
});
test('nested record type display', () async {
- await onBreakPoint('printNestedLocalRecord', (event) async {
+ await onBreakPoint('printNestedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final typeStringRef = await getInstanceRef(
frame,
@@ -348,7 +352,7 @@
});
test('nested record type with named fields', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -357,13 +361,13 @@
expect(instanceRef, matchRecordTypeInstanceRef(length: 2));
expect(instance, matchRecordTypeInstance(length: 2));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
});
});
test('nested record type with named fields elements', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instanceId = instanceRef.id!;
@@ -387,7 +391,7 @@
});
test('nested record type with named fields getters', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final elements = await getElements(instanceRef.id!);
@@ -404,11 +408,11 @@
});
test('nested record type with named fields display', () async {
- await onBreakPoint('printNestedNamedLocalRecord', (event) async {
+ await onBreakPoint('printNestedNamedLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, 'record.runtimeType');
final instance = await getObject(instanceRef.id!);
- final typeClassId = instance.classRef!.id;
+ final typeClassId = instance.classRef!.id!;
expect(await getObject(typeClassId), matchRecordTypeClass);
diff --git a/dwds/test/integration/instances/common/test_inspector.dart b/dwds/test/integration/instances/common/test_inspector.dart
index 0dc201e..4423659 100644
--- a/dwds/test/integration/instances/common/test_inspector.dart
+++ b/dwds/test/integration/instances/common/test_inspector.dart
@@ -37,7 +37,7 @@
);
final event = await stream.firstWhere(
- (e) => e.kind == EventKind.kPauseBreakpoint,
+ (Event e) => e.kind == EventKind.kPauseBreakpoint,
);
await body(event);
@@ -240,8 +240,8 @@
/// A limit on the number of stops to record.
///
- /// The program will not be resumed after the length of [recordedStops]
- /// becomes [numStops].
+ /// The program will not be resumed after the length of `recordedStops`
+ /// becomes `numStops`.
int numStops,
) async {
final completer = Completer<void>();
@@ -272,19 +272,24 @@
Map<String, InstanceRef> _associationsToMap(
Iterable<MapAssociation> associations,
) => Map.fromEntries(
- associations.map((e) => MapEntry(e.key.valueAsString, e.value)),
+ associations.map(
+ (e) =>
+ MapEntry((e.key as InstanceRef).valueAsString!, e.value as InstanceRef),
+ ),
);
Map<dynamic, InstanceRef> _boundFieldsToMap(Iterable<BoundField> fields) =>
Map.fromEntries(
- fields.where((e) => e.name != null).map((e) => MapEntry(e.name, e.value)),
+ fields
+ .where((e) => e.name != null)
+ .map((e) => MapEntry(e.name, e.value as InstanceRef)),
);
Map<dynamic, InstanceRef> _elementsToMap(List<dynamic> fields) =>
Map.fromEntries(
fields
.where((e) => e != null)
- .map((e) => MapEntry(fields.indexOf(e), e!)),
+ .map((e) => MapEntry(fields.indexOf(e), e as InstanceRef)),
);
Matcher matchRecordInstanceRef({required int length}) => isA<InstanceRef>()
@@ -312,7 +317,7 @@
.having((e) => e.kind, 'kind', kind)
.having(_getValue, 'value', value);
-Matcher matchPlainInstance({required libraryId, required String type}) =>
+Matcher matchPlainInstance({required String libraryId, required String type}) =>
isA<Instance>()
.having((e) => e.kind, 'kind', InstanceKind.kPlainInstance)
.having(
@@ -321,7 +326,7 @@
matchClassRef(name: type, libraryId: libraryId),
);
-Matcher matchListInstance({required dynamic type}) => isA<Instance>()
+Matcher matchListInstance({required String type}) => isA<Instance>()
.having((e) => e.kind, 'kind', InstanceKind.kList)
.having((e) => e.classRef, 'classRef', matchListClassRef(type));
diff --git a/dwds/test/integration/instances/common/type_inspection_common.dart b/dwds/test/integration/instances/common/type_inspection_common.dart
index ff9954d..cc45462 100644
--- a/dwds/test/integration/instances/common/type_inspection_common.dart
+++ b/dwds/test/integration/instances/common/type_inspection_common.dart
@@ -27,7 +27,10 @@
late String isolateId;
late ScriptRef mainScript;
- Future<void> onBreakPoint(breakPointId, body) => testInspector.onBreakPoint(
+ Future<void> onBreakPoint(
+ String breakPointId,
+ Future<void> Function(Event) body,
+ ) => testInspector.onBreakPoint(
stream,
isolateId,
mainScript,
@@ -35,22 +38,23 @@
body,
);
- Future<Obj> getObject(instanceId) => service.getObject(isolateId, instanceId);
+ Future<Obj> getObject(String instanceId) =>
+ service.getObject(isolateId, instanceId);
- Future<Map<Object?, String?>> getDisplayedFields(instanceRef) =>
+ Future<Map<Object?, String?>> getDisplayedFields(InstanceRef instanceRef) =>
testInspector.getDisplayedFields(isolateId, instanceRef);
- Future<Map<Object?, String?>> getDisplayedGetters(instanceRef) =>
+ Future<Map<Object?, String?>> getDisplayedGetters(InstanceRef instanceRef) =>
testInspector.getDisplayedGetters(isolateId, instanceRef);
- Future<InstanceRef> getInstanceRef(frame, expression) =>
+ Future<InstanceRef> getInstanceRef(int frame, String expression) =>
testInspector.getInstanceRef(isolateId, frame, expression);
Future<Map<Object?, Object?>> getFields(
- instanceRef, {
- offset,
- count,
- depth = -1,
+ InstanceRef instanceRef, {
+ int? offset,
+ int? count,
+ int depth = -1,
}) => testInspector.getFields(
isolateId,
instanceRef,
@@ -62,15 +66,15 @@
Future<List<Instance>> getElements(String instanceId) =>
testInspector.getElements(isolateId, instanceId);
- final matchTypeObjectFields = {
+ final matchTypeObjectFields = <String, dynamic>{
if (provider.ddcModuleFormat == ModuleFormat.ddc) '_rti': anything,
};
- final matchDisplayedTypeObjectFields = {
+ final matchDisplayedTypeObjectFields = <String, dynamic>{
if (provider.ddcModuleFormat == ModuleFormat.ddc) '_rti': anything,
};
- final matchDisplayedTypeObjectGetters = {
+ final matchDisplayedTypeObjectGetters = <String, dynamic>{
'hashCode': matches('[0-9]*'),
'runtimeType': matchTypeClassName,
};
@@ -110,7 +114,7 @@
tearDown(() => service.resume(isolateId));
test('String type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, "'1'.runtimeType");
expect(instanceRef, matchTypeInstanceRef('String'));
@@ -119,7 +123,7 @@
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('String'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -130,7 +134,7 @@
});
test('String type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, "'1'.runtimeType");
@@ -142,7 +146,7 @@
});
test('int type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, '1.runtimeType');
expect(instanceRef, matchTypeInstanceRef('int'));
@@ -151,7 +155,7 @@
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('int'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -162,7 +166,7 @@
});
test('int type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, '1.runtimeType');
@@ -174,7 +178,7 @@
});
test('list type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, '<int>[].runtimeType');
expect(instanceRef, matchTypeInstanceRef('List<int>'));
@@ -183,7 +187,7 @@
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('List<int>'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -198,7 +202,7 @@
});
test('map type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(
frame,
@@ -210,7 +214,7 @@
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('IdentityMap<int, String>'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -221,7 +225,7 @@
});
test('map type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(
frame,
@@ -236,7 +240,7 @@
});
test('set type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, '<int>{}.runtimeType');
expect(instanceRef, matchTypeInstanceRef('IdentitySet<int>'));
@@ -245,7 +249,7 @@
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('IdentitySet<int>'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -256,7 +260,7 @@
});
test('set type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, '<int>{}.runtimeType');
@@ -268,7 +272,7 @@
});
test('record type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, "(0,'a').runtimeType");
expect(instanceRef, matchRecordTypeInstanceRef(length: 2));
@@ -281,7 +285,7 @@
matchTypeInstance('String'),
]);
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchRecordTypeClass);
expect(await getFields(instanceRef, depth: 2), {
1: matchTypeObjectFields,
@@ -292,7 +296,7 @@
});
test('record type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(frame, "(0,'a').runtimeType");
@@ -304,7 +308,7 @@
});
test('class type', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(
frame,
@@ -315,7 +319,7 @@
final instanceId = instanceRef.id!;
final instance = await getObject(instanceId);
expect(instance, matchTypeInstance('_Uri'));
- final classId = instanceRef.classRef!.id;
+ final classId = instanceRef.classRef!.id!;
expect(await getObject(classId), matchTypeClass);
expect(await getFields(instanceRef, depth: 1), matchTypeObjectFields);
expect(
@@ -326,7 +330,7 @@
});
test('class type getters', () async {
- await onBreakPoint('printSimpleLocalRecord', (event) async {
+ await onBreakPoint('printSimpleLocalRecord', (Event event) async {
final frame = event.topFrame!.index!;
final instanceRef = await getInstanceRef(
frame,
diff --git a/dwds/test/integration/load_strategy_test.dart b/dwds/test/integration/load_strategy_test.dart
index 80e9318..6ca17eb 100644
--- a/dwds/test/integration/load_strategy_test.dart
+++ b/dwds/test/integration/load_strategy_test.dart
@@ -59,7 +59,7 @@
group('When default build settings defined', () {
late final strategy = FakeStrategy(
FakeAssetReader(),
- buildSettings: TestBuildSettings.dart(),
+ buildSettings: const TestBuildSettings.dart(),
);
test('uses the default app entrypoint', () {
diff --git a/dwds/test/integration/metadata/class_test.dart b/dwds/test/integration/metadata/class_test.dart
index 6bf247c..d03d307 100644
--- a/dwds/test/integration/metadata/class_test.dart
+++ b/dwds/test/integration/metadata/class_test.dart
@@ -19,7 +19,7 @@
var metadata = createMetadata(null);
expect(metadata.length, isNull);
- metadata = createMetadata({});
+ metadata = createMetadata(<dynamic, dynamic>{});
expect(metadata.length, isNull);
metadata = createMetadata('{}');
diff --git a/dwds/test/integration/package_uri_mapper_test.dart b/dwds/test/integration/package_uri_mapper_test.dart
index 2ad85d0..8d8e895 100644
--- a/dwds/test/integration/package_uri_mapper_test.dart
+++ b/dwds/test/integration/package_uri_mapper_test.dart
@@ -21,7 +21,7 @@
for (final useDebuggerModuleNames in [true, false]) {
group('Package uri mapper with debugger module names: '
' $useDebuggerModuleNames |', () {
- final fileSystem = LocalFileSystem();
+ final fileSystem = const LocalFileSystem();
final packageUri = Uri(
scheme: 'package',
diff --git a/dwds/test/integration/refresh_common.dart b/dwds/test/integration/refresh_common.dart
index 3e9fab0..b4a2f2a 100644
--- a/dwds/test/integration/refresh_common.dart
+++ b/dwds/test/integration/refresh_common.dart
@@ -40,7 +40,7 @@
test('can add and remove after a refresh', () async {
final stream = service.onEvent('Isolate');
// Wait for the page to be fully loaded before refreshing.
- await Future.delayed(const Duration(seconds: 1));
+ await Future<void>.delayed(const Duration(seconds: 1));
// Now wait for the shutdown event.
final exitEvent = stream.firstWhere(
(e) => e.kind != EventKind.kIsolateExit,
diff --git a/dwds/test/integration/run_request_test.dart b/dwds/test/integration/run_request_test.dart
index 1d4097a..b7decf3 100644
--- a/dwds/test/integration/run_request_test.dart
+++ b/dwds/test/integration/run_request_test.dart
@@ -48,7 +48,7 @@
final isolate = await service.getIsolate(vm.isolates!.first.id!);
expect(isolate.pauseEvent!.kind, EventKind.kPauseStart);
final stream = service.onEvent('Debug');
- final resumeCompleter = Completer();
+ final resumeCompleter = Completer<void>();
// The underlying stream is a broadcast stream so we need to add a
// listener before calling resume so that we don't miss events.
unawaited(
@@ -70,13 +70,13 @@
await stream.firstWhere((event) => event.kind == EventKind.kResume);
expect(isolate.pauseEvent!.kind, EventKind.kResume);
});
- }, timeout: Timeout.factor(2));
+ }, timeout: const Timeout.factor(2));
group('while debugger is not attached', () {
setUp(() async {
setCurrentLogWriter(debug: provider.verbose);
await context.setUp(
- testSettings: TestSettings(autoRun: false, waitToDebug: true),
+ testSettings: const TestSettings(autoRun: false, waitToDebug: true),
);
});
diff --git a/dwds/test/integration/sdk_configuration_test.dart b/dwds/test/integration/sdk_configuration_test.dart
index 05dd1af..b8d6455 100644
--- a/dwds/test/integration/sdk_configuration_test.dart
+++ b/dwds/test/integration/sdk_configuration_test.dart
@@ -26,13 +26,13 @@
group('Basic configuration', () {
test('Can validate default configuration layout', () async {
final defaultConfiguration =
- await DefaultSdkConfigurationProvider().configuration;
+ await const DefaultSdkConfigurationProvider().configuration;
defaultConfiguration.validateSdkDir();
defaultConfiguration.validateSummaries();
});
test('Cannot validate an empty configuration layout', () async {
- final emptyConfiguration = SdkConfiguration.empty();
+ final emptyConfiguration = const SdkConfiguration.empty();
expect(emptyConfiguration.validateSdkDir, _throwsDoesNotExistException);
expect(emptyConfiguration.validate, _throwsDoesNotExistException);
});
@@ -52,7 +52,7 @@
test('Can validate existing configuration layout', () async {
final defaultSdkConfiguration =
- await DefaultSdkConfigurationProvider().configuration;
+ await const DefaultSdkConfigurationProvider().configuration;
final sdkDirectory = outputDir.path;
final sdkLayout = FakeSdkLayout(sdkDirectory);
diff --git a/dwds/test/integration/serialization_test.dart b/dwds/test/integration/serialization_test.dart
index d502a9d..a417dce 100644
--- a/dwds/test/integration/serialization_test.dart
+++ b/dwds/test/integration/serialization_test.dart
@@ -159,7 +159,7 @@
group('DebugInfo', () {
test('serializes and deserializes', () {
- final info = DebugInfo(
+ final info = const DebugInfo(
appEntrypointPath: 'appEntrypointPath',
appId: 'appId',
appInstanceId: 'appInstanceId',
diff --git a/dwds/test/integration/skip_list_test.dart b/dwds/test/integration/skip_list_test.dart
index 0707fdc..55ed079 100644
--- a/dwds/test/integration/skip_list_test.dart
+++ b/dwds/test/integration/skip_list_test.dart
@@ -113,10 +113,10 @@
int endLine,
int endColumn,
) {
- final start = range['start'];
+ final start = range['start'] as Map<String, dynamic>;
expect(start['lineNumber'], startLine);
expect(start['columnNumber'], startColumn);
- final end = range['end'];
+ final end = range['end'] as Map<String, dynamic>;
expect(end['lineNumber'], endLine);
expect(end['columnNumber'], endColumn);
}
diff --git a/dwds/test/integration/utilities_test.dart b/dwds/test/integration/utilities_test.dart
index 8b9f428..83231ea 100644
--- a/dwds/test/integration/utilities_test.dart
+++ b/dwds/test/integration/utilities_test.dart
@@ -15,7 +15,7 @@
group('wrapInErrorHandlerAsync', () {
test('returns future success value if callback succeeds', () async {
Future<bool> successCallback() async {
- await Future.delayed(Duration(milliseconds: 500));
+ await Future<void>.delayed(const Duration(milliseconds: 500));
return true;
}
@@ -28,7 +28,7 @@
test('throws RPCError if callback throws RPCError', () async {
Future<bool> rpcErrorCallback() async {
- await Future.delayed(Duration(milliseconds: 500));
+ await Future<void>.delayed(const Duration(milliseconds: 500));
throw RPCError(
'rpcErrorCallback',
RPCErrorKind.kInvalidRequest.code,
@@ -46,7 +46,7 @@
'throws SentinelException if callback throws SentinelException',
() async {
Future<bool> sentinelExceptionCallback() async {
- await Future.delayed(Duration(milliseconds: 500));
+ await Future<void>.delayed(const Duration(milliseconds: 500));
throw SentinelException.parse('sentinelExceptionCallback', {
'message': 'a sentinel exception',
});
@@ -64,7 +64,7 @@
test('throws RPCError if callback throws other error type', () async {
Future<bool> exceptionCallback() async {
- await Future.delayed(Duration(milliseconds: 500));
+ await Future<void>.delayed(const Duration(milliseconds: 500));
throw Exception('An unexpected exception');
}
@@ -75,7 +75,8 @@
expect(
error,
isRPCErrorWithMessage(
- 'Unexpected DWDS error for exceptionCallback: Exception: An unexpected exception',
+ 'Unexpected DWDS error for exceptionCallback: Exception: An '
+ 'unexpected exception',
),
);
}
diff --git a/dwds/test/integration/variable_scope_common.dart b/dwds/test/integration/variable_scope_common.dart
index 3f3f2c5..a1191aa 100644
--- a/dwds/test/integration/variable_scope_common.dart
+++ b/dwds/test/integration/variable_scope_common.dart
@@ -285,8 +285,8 @@
);
expect(parameter.value, matches(RegExp(r'\d+ world')));
final ticks = await debugger.evaluateJsOnCallFrameIndex(1, 'ticks');
- // We don't know how many ticks there were before we stopped, but it should
- // be a positive number.
+ // We don't know how many ticks there were before we stopped, but it
+ // should be a positive number.
expect(ticks.value, isPositive);
});
});
diff --git a/dwds/test/integration/web/batched_stream_test.dart b/dwds/test/integration/web/batched_stream_test.dart
index 1603256..78e8249 100644
--- a/dwds/test/integration/web/batched_stream_test.dart
+++ b/dwds/test/integration/web/batched_stream_test.dart
@@ -35,7 +35,7 @@
final inputAdded = controller.sink.addStream(inputController.stream);
batchOne.forEach(inputController.sink.add);
- await Future.delayed(delay);
+ await Future<void>.delayed(delay);
batchTwo.forEach(inputController.sink.add);
await inputController.close();
@@ -63,7 +63,7 @@
final input = List<int>.generate(size, (index) => index);
for (final e in input) {
inputController.sink.add(e);
- await Future.delayed(delay);
+ await Future<void>.delayed(delay);
}
await inputController.close();
diff --git a/dwds/test/utilities/uuid_test.dart b/dwds/test/utilities/uuid_test.dart
index a67acf2..51c4216 100644
--- a/dwds/test/utilities/uuid_test.dart
+++ b/dwds/test/utilities/uuid_test.dart
@@ -8,28 +8,29 @@
void main() {
group('Uuid', () {
test('v4 generates valid UUIDs', () {
- final uuid = Uuid();
+ final uuid = const Uuid();
final id = uuid.v4();
expect(id, hasLength(36));
expect(
id,
matches(
RegExp(
- r'^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
+ r'^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-'
+ r'[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
),
),
);
});
test('v4 generates unique UUIDs', () {
- final uuid = Uuid();
+ final uuid = const Uuid();
final id1 = uuid.v4();
final id2 = uuid.v4();
expect(id1, isNot(equals(id2)));
});
test('v4 sets version and variant bits correctly', () {
- final uuid = Uuid();
+ final uuid = const Uuid();
final id = uuid.v4();
// Version 4
expect(id[14], equals('4'));
diff --git a/dwds/web/client.dart b/dwds/web/client.dart
index c297ff2..1d40ec2 100644
--- a/dwds/web/client.dart
+++ b/dwds/web/client.dart
@@ -237,9 +237,9 @@
},
onError: (error) {
// An error is propagated on a full page reload as Chrome presumably
- // forces the SSE connection to close in a bad state. This does not cause
- // any adverse effects so simply swallow this error as to not print the
- // misleading unhandled error message.
+ // forces the SSE connection to close in a bad state. This does not
+ // cause any adverse effects so simply swallow this error as to not
+ // print the misleading unhandled error message.
},
);
@@ -299,6 +299,7 @@
void _trySendEvent<T>(StreamSink<T> sink, T serialized) {
try {
sink.add(serialized);
+ // ignore: avoid_catching_errors
} on StateError catch (_) {
// An error is propagated on a full page reload as Chrome presumably
// forces the SSE connection to close in a bad state.
@@ -614,7 +615,8 @@
/// App-initiated hot restart.
///
-/// When there's no debugger attached, the DWDS dev handler sends the request back, and it will be handled by the client stream listener.
+/// When there's no debugger attached, the DWDS dev handler sends the request
+/// back, and it will be handled by the client stream listener.
@JS(r'$dartRequestHotRestartDwds')
external set requestHotRestartJs(JSFunction cb);
@@ -636,9 +638,6 @@
@JS(r'$dwdsEnableDevToolsLaunch')
external bool get dwdsEnableDevToolsLaunch;
-@JS('window.top.document.dispatchEvent')
-external void dispatchEvent(CustomEvent event);
-
@JS(r'$dartEmitDebugEvents')
external bool get dartEmitDebugEvents;
@@ -648,12 +647,6 @@
@JS(r'$emitRegisterEvent')
external set emitRegisterEvent(JSFunction func);
-@JS(r'$isInternalBuild')
-external bool get isInternalBuild;
-
-@JS(r'$isFlutterApp')
-external bool get isFlutterApp;
-
@JS(r'$dartWorkspaceName')
external String? get dartWorkspaceName;
diff --git a/dwds/web/reloader/manager.dart b/dwds/web/reloader/manager.dart
index 848cb5f..8c3f52a 100644
--- a/dwds/web/reloader/manager.dart
+++ b/dwds/web/reloader/manager.dart
@@ -99,7 +99,8 @@
window.location.reload();
}
- /// Handles service extension requests by delegating to the appropriate restarter
+ /// Handles service extension requests by delegating to the appropriate
+ /// restarter
Future<Map<String, dynamic>?> handleServiceExtension(
String method,
Map<String, dynamic> args,
diff --git a/dwds/web/reloader/require_restarter.dart b/dwds/web/reloader/require_restarter.dart
index d2e7eb1..61ba853 100644
--- a/dwds/web/reloader/require_restarter.dart
+++ b/dwds/web/reloader/require_restarter.dart
@@ -126,7 +126,7 @@
late SplayTreeSet<String> _dirtyModules;
var _running = Completer<bool>()..complete(true);
- var count = 0;
+ int count = 0;
RequireRestarter._() {
_dirtyModules = SplayTreeSet(_moduleTopologicalCompare);
@@ -275,7 +275,7 @@
}
Future<void> _reloadModule(String moduleId) {
- final completer = Completer();
+ final completer = Completer<void>();
final stackTrace = StackTrace.current;
requireLoader.forceLoadModule(
moduleId.toJS,