@@ -40,7 +40,7 @@ String decodeBase64(String str) => utf8.decode(base64.decode(str));
4040bool _isNullInstance (Map json) =>
4141 ((json['type' ] == '@Instance' ) && (json['kind' ] == 'Null' ));
4242
43- Object ? createServiceObject (dynamic json, List <String > expectedTypes) {
43+ Object ? createServiceObject (Object ? json, List <String > expectedTypes) {
4444 if (json == null ) return null ;
4545
4646 if (json is List ) {
@@ -75,7 +75,7 @@ Object? createServiceObject(dynamic json, List<String> expectedTypes) {
7575}
7676
7777dynamic _createSpecificObject (
78- dynamic json, dynamic Function (Map <String , dynamic > map) creator) {
78+ Object ? json, dynamic Function (Map <String , dynamic > map) creator) {
7979 if (json == null ) return null ;
8080
8181 if (json is List ) {
@@ -1981,8 +1981,8 @@ class VmService {
19811981 _services[service] = cb;
19821982 }
19831983
1984- void _processMessage (dynamic message) {
1985- // Expect a String, an int[] , or a ByteData.
1984+ void _processMessage (Object ? message) {
1985+ // Expect a String, a List< int> , or a ByteData.
19861986 if (message is String ) {
19871987 _processMessageStr (message);
19881988 } else if (message is Uint8List ) {
@@ -2005,7 +2005,7 @@ class VmService {
20052005 final dataLength = bytes.lengthInBytes - dataOffset;
20062006 final decoder = (const Utf8Decoder ()).fuse (const JsonDecoder ());
20072007 final map = decoder.convert (Uint8List .view (
2008- bytes.buffer, bytes.offsetInBytes + metaOffset, metaLength)) as dynamic ;
2008+ bytes.buffer, bytes.offsetInBytes + metaOffset, metaLength)) as Map ;
20092009 final data = ByteData .view (
20102010 bytes.buffer, bytes.offsetInBytes + dataOffset, dataLength);
20112011 if (map['method' ] == 'streamNotify' ) {
@@ -2043,8 +2043,8 @@ class VmService {
20432043 final request = _outstandingRequests.remove (json['id' ]);
20442044 if (request == null ) {
20452045 _log.severe ('unmatched request response: ${jsonEncode (json )}' );
2046- } else if (json['error' ] != null ) {
2047- request.completeError (RPCError .parse (request.method, json[ ' error' ] ));
2046+ } else if (json['error' ] case Map error ) {
2047+ request.completeError (RPCError .parse (request.method, error));
20482048 } else {
20492049 final result = json['result' ] as Map <String , dynamic >;
20502050 final type = result['type' ];
@@ -2059,7 +2059,7 @@ class VmService {
20592059 }
20602060 }
20612061
2062- Future _processRequest (Map <String , dynamic > json) async {
2062+ Future < void > _processRequest (Map <String , dynamic > json) async {
20632063 final result = await _routeRequest (
20642064 json['method' ], json['params' ] ?? < String , dynamic > {});
20652065 if (_disposed) {
@@ -2068,12 +2068,12 @@ class VmService {
20682068 }
20692069 result['id' ] = json['id' ];
20702070 result['jsonrpc' ] = '2.0' ;
2071- String message = jsonEncode (result);
2071+ final message = jsonEncode (result);
20722072 _onSend.add (message);
20732073 _writeMessage (message);
20742074 }
20752075
2076- Future _processNotification (Map <String , dynamic > json) async {
2076+ Future < void > _processNotification (Map <String , dynamic > json) async {
20772077 final method = json['method' ];
20782078 final params = json['params' ] ?? < String , dynamic > {};
20792079 if (method == 'streamNotify' ) {
@@ -2096,7 +2096,7 @@ class VmService {
20962096 try {
20972097 return await service (params);
20982098 } catch (e, st) {
2099- RPCError error = RPCError .withDetails (
2099+ final error = RPCError .withDetails (
21002100 method,
21012101 RPCErrorKind .kServerError.code,
21022102 '$e ' ,
@@ -2107,7 +2107,7 @@ class VmService {
21072107 }
21082108}
21092109
2110- typedef DisposeHandler = Future Function ();
2110+ typedef DisposeHandler = Future < void > Function ();
21112111
21122112// These error codes must be kept in sync with those in vm/json_stream.h and
21132113// vmservice.dart.
@@ -2214,7 +2214,7 @@ enum RPCErrorKind {
22142214}
22152215
22162216class RPCError implements Exception {
2217- static RPCError parse (String callingMethod, dynamic json) {
2217+ static RPCError parse (String callingMethod, Map json) {
22182218 return RPCError (callingMethod, json['code' ], json['message' ], json['data' ]);
22192219 }
22202220
@@ -2734,10 +2734,9 @@ class BoundField {
27342734 BoundField ._fromJson (Map <String , dynamic > json)
27352735 : decl =
27362736 createServiceObject (json['decl' ], const ['FieldRef' ]) as FieldRef ? ,
2737- name = createServiceObject (json['name' ], const ['String' , 'int' ])
2738- as dynamic ,
2737+ name = createServiceObject (json['name' ], const ['String' , 'int' ]),
27392738 value = createServiceObject (
2740- json['value' ], const ['InstanceRef' , 'Sentinel' ]) as dynamic ;
2739+ json['value' ], const ['InstanceRef' , 'Sentinel' ]);
27412740
27422741 Map <String , dynamic > toJson () => < String , Object ? > {
27432742 'decl' : decl? .toJson (),
@@ -2786,7 +2785,7 @@ class BoundVariable extends Response {
27862785 BoundVariable ._fromJson (super .json)
27872786 : name = json['name' ] ?? '' ,
27882787 value = createServiceObject (json['value' ],
2789- const ['InstanceRef' , 'TypeArgumentsRef' , 'Sentinel' ]) as dynamic ,
2788+ const ['InstanceRef' , 'TypeArgumentsRef' , 'Sentinel' ]),
27902789 declarationTokenPos = json['declarationTokenPos' ] ?? - 1 ,
27912790 scopeStartTokenPos = json['scopeStartTokenPos' ] ?? - 1 ,
27922791 scopeEndTokenPos = json['scopeEndTokenPos' ] ?? - 1 ,
@@ -2857,7 +2856,7 @@ class Breakpoint extends Obj {
28572856 resolved = json['resolved' ] ?? false ,
28582857 isSyntheticAsyncContinuation = json['isSyntheticAsyncContinuation' ],
28592858 location = createServiceObject (json['location' ],
2860- const ['SourceLocation' , 'UnresolvedSourceLocation' ]) as dynamic ,
2859+ const ['SourceLocation' , 'UnresolvedSourceLocation' ]),
28612860 super ._fromJson ();
28622861
28632862 @override
@@ -3260,7 +3259,7 @@ class CodeRef extends ObjRef {
32603259 : name = json['name' ] ?? '' ,
32613260 kind = json['kind' ] ?? '' ,
32623261 function = createServiceObject (
3263- json['function' ], const ['FuncRef' , 'NativeFunction' ]) as dynamic ,
3262+ json['function' ], const ['FuncRef' , 'NativeFunction' ]),
32643263 super ._fromJson ();
32653264
32663265 @override
@@ -3319,7 +3318,7 @@ class Code extends Obj implements CodeRef {
33193318 : name = json['name' ] ?? '' ,
33203319 kind = json['kind' ] ?? '' ,
33213320 function = createServiceObject (
3322- json['function' ], const ['FuncRef' , 'NativeFunction' ]) as dynamic ,
3321+ json['function' ], const ['FuncRef' , 'NativeFunction' ]),
33233322 super ._fromJson ();
33243323
33253324 @override
@@ -3453,7 +3452,7 @@ class ContextElement {
34533452
34543453 ContextElement ._fromJson (Map <String , dynamic > json)
34553454 : value = createServiceObject (
3456- json['value' ], const ['InstanceRef' , 'Sentinel' ]) as dynamic ;
3455+ json['value' ], const ['InstanceRef' , 'Sentinel' ]);
34573456
34583457 Map <String , dynamic > toJson () => < String , Object ? > {
34593458 'value' : value? .toJson (),
@@ -4371,7 +4370,7 @@ class Field extends Obj implements FieldRef {
43714370 createServiceObject (json['location' ], const ['SourceLocation' ])
43724371 as SourceLocation ? ,
43734372 staticValue = createServiceObject (
4374- json['staticValue' ], const ['InstanceRef' , 'Sentinel' ]) as dynamic ,
4373+ json['staticValue' ], const ['InstanceRef' , 'Sentinel' ]),
43754374 super ._fromJson ();
43764375
43774376 @override
@@ -4606,8 +4605,7 @@ class FuncRef extends ObjRef {
46064605 FuncRef ._fromJson (super .json)
46074606 : name = json['name' ] ?? '' ,
46084607 owner = createServiceObject (
4609- json['owner' ], const ['LibraryRef' , 'ClassRef' , 'FuncRef' ])
4610- as dynamic ,
4608+ json['owner' ], const ['LibraryRef' , 'ClassRef' , 'FuncRef' ]),
46114609 isStatic = json['static' ] ?? false ,
46124610 isConst = json['const' ] ?? false ,
46134611 implicit = json['implicit' ] ?? false ,
@@ -4727,8 +4725,7 @@ class Func extends Obj implements FuncRef {
47274725 Func ._fromJson (super .json)
47284726 : name = json['name' ] ?? '' ,
47294727 owner = createServiceObject (
4730- json['owner' ], const ['LibraryRef' , 'ClassRef' , 'FuncRef' ])
4731- as dynamic ,
4728+ json['owner' ], const ['LibraryRef' , 'ClassRef' , 'FuncRef' ]),
47324729 isStatic = json['static' ] ?? false ,
47334730 isConst = json['const' ] ?? false ,
47344731 implicit = json['implicit' ] ?? false ,
@@ -6171,8 +6168,7 @@ class InboundReference {
61716168 createServiceObject (json['source' ], const ['ObjRef' ]) as ObjRef ? ,
61726169 parentListIndex = json['parentListIndex' ],
61736170 parentField = createServiceObject (
6174- json['parentField' ], const ['FieldRef' , 'String' , 'int' ])
6175- as dynamic ;
6171+ json['parentField' ], const ['FieldRef' , 'String' , 'int' ]);
61766172
61776173 Map <String , dynamic > toJson () => < String , Object ? > {
61786174 'source' : source? .toJson (),
@@ -6521,10 +6517,9 @@ class MapAssociation {
65216517
65226518 MapAssociation ._fromJson (Map <String , dynamic > json)
65236519 : key =
6524- createServiceObject (json['key' ], const ['InstanceRef' , 'Sentinel' ])
6525- as dynamic ,
6520+ createServiceObject (json['key' ], const ['InstanceRef' , 'Sentinel' ]),
65266521 value = createServiceObject (
6527- json['value' ], const ['InstanceRef' , 'Sentinel' ]) as dynamic ;
6522+ json['value' ], const ['InstanceRef' , 'Sentinel' ]);
65286523
65296524 Map <String , dynamic > toJson () => < String , Object ? > {
65306525 'key' : key? .toJson (),
@@ -7179,8 +7174,7 @@ class ProfileFunction {
71797174 inclusiveTicks = json['inclusiveTicks' ] ?? - 1 ,
71807175 exclusiveTicks = json['exclusiveTicks' ] ?? - 1 ,
71817176 resolvedUrl = json['resolvedUrl' ] ?? '' ,
7182- function =
7183- createServiceObject (json['function' ], const ['dynamic' ]) as dynamic ;
7177+ function = createServiceObject (json['function' ], const ['dynamic' ]);
71847178
71857179 Map <String , dynamic > toJson () => < String , Object ? > {
71867180 'kind' : kind ?? '' ,
@@ -7449,8 +7443,7 @@ class RetainingObject {
74497443 createServiceObject (json['parentMapKey' ], const ['ObjRef' ])
74507444 as ObjRef ? ,
74517445 parentField =
7452- createServiceObject (json['parentField' ], const ['String' , 'int' ])
7453- as dynamic ;
7446+ createServiceObject (json['parentField' ], const ['String' , 'int' ]);
74547447
74557448 Map <String , dynamic > toJson () => < String , Object ? > {
74567449 'value' : value? .toJson (),
0 commit comments