@@ -30,11 +30,16 @@ final _eventsForAngularDartDevTools = {
3030};
3131
3232Future <void > handleMessagesFromAngularDartDevTools (
33- dynamic jsRequest,
33+ Object ? jsRequest,
3434 // ignore: avoid-unused-parameters
3535 MessageSender sender,
3636 Function sendResponse,
3737) async {
38+ if (sendResponse is ! void Function (Object )) {
39+ throw StateError (
40+ 'Unexpected sendResponse signature: ${sendResponse .runtimeType }' ,
41+ );
42+ }
3843 if (jsRequest == null ) return ;
3944 final message = jsRequest as ExternalExtensionMessage ;
4045 if (message.name == 'chrome.debugger.sendCommand' ) {
@@ -53,7 +58,7 @@ Future<void> handleMessagesFromAngularDartDevTools(
5358
5459void maybeForwardMessageToAngularDartDevTools ({
5560 required String method,
56- required dynamic params,
61+ required Object ? params,
5762 required int tabId,
5863}) {
5964 if (! _eventsForAngularDartDevTools.contains (method)) return ;
@@ -67,7 +72,7 @@ void maybeForwardMessageToAngularDartDevTools({
6772
6873void _forwardCommandToChromeDebugger (
6974 ExternalExtensionMessage message,
70- Function sendResponse,
75+ void Function ( Object ) sendResponse,
7176) {
7277 try {
7378 final options = message.options as SendCommandOptions ;
@@ -76,15 +81,18 @@ void _forwardCommandToChromeDebugger(
7681 options.method,
7782 options.commandParams,
7883 allowInterop (
79- ([result]) => _respondWithChromeResult (result, sendResponse),
84+ ([Object ? result]) => _respondWithChromeResult (result, sendResponse),
8085 ),
8186 );
8287 } catch (e) {
8388 sendResponse (ErrorResponse ()..error = '$e ' );
8489 }
8590}
8691
87- void _respondWithChromeResult (Object ? chromeResult, Function sendResponse) {
92+ void _respondWithChromeResult (
93+ Object ? chromeResult,
94+ void Function (Object ) sendResponse,
95+ ) {
8896 // No result indicates that an error occurred.
8997 if (chromeResult == null ) {
9098 sendResponse (
@@ -96,7 +104,10 @@ void _respondWithChromeResult(Object? chromeResult, Function sendResponse) {
96104 }
97105}
98106
99- Future <void > _respondWithEncodedUri (int tabId, Function sendResponse) async {
107+ Future <void > _respondWithEncodedUri (
108+ int tabId,
109+ void Function (Object ) sendResponse,
110+ ) async {
100111 final encodedUri = await fetchStorageObject <String >(
101112 type: StorageObject .encodedUri,
102113 tabId: tabId,
@@ -110,7 +121,7 @@ void _forwardMessageToAngularDartDevTools(ExternalExtensionMessage message) {
110121 message,
111122 // options
112123 null ,
113- allowInterop (([result]) => _checkForErrors (result, message.name)),
124+ allowInterop (([Object ? result]) => _checkForErrors (result, message.name)),
114125 );
115126}
116127
@@ -124,7 +135,7 @@ void _checkForErrors(Object? chromeResult, String messageName) {
124135
125136ExternalExtensionMessage _debugEventMessage ({
126137 required String method,
127- required dynamic params,
138+ required Object ? params,
128139 required int tabId,
129140}) => ExternalExtensionMessage (
130141 name: 'chrome.debugger.event' ,
@@ -134,7 +145,7 @@ ExternalExtensionMessage _debugEventMessage({
134145
135146ExternalExtensionMessage _dwdsEventMessage ({
136147 required String method,
137- required dynamic params,
148+ required Object ? params,
138149 required int tabId,
139150}) => ExternalExtensionMessage (name: method, tabId: tabId, options: params);
140151
@@ -145,11 +156,11 @@ ExternalExtensionMessage _dwdsEventMessage({
145156class ExternalExtensionMessage {
146157 external int get tabId;
147158 external String get name;
148- external dynamic get options;
159+ external Object ? get options;
149160 external factory ExternalExtensionMessage ({
150161 required int tabId,
151162 required String name,
152- required dynamic options,
163+ required Object ? options,
153164 });
154165}
155166
0 commit comments