Eliminate [] dynamic call in io_resource_info.

Change-Id: I80a30d8c31ecc41f2ebf6f7fc8ac6dd41225ea4e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256600
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
This commit is contained in:
Kallen Tu
2022-08-29 18:53:15 +00:00
committed by Commit Bot
parent 23507bf6ab
commit bcb9fd28fb
2 changed files with 3 additions and 3 deletions
@@ -52,7 +52,6 @@
"Dynamic invocation of '[]'.": 7
},
"org-dartlang-sdk:///lib/io/io_resource_info.dart": {
"Dynamic invocation of '[]'.": 1,
"Dynamic access of 'path'.": 1,
"Dynamic access of 'dart.io::_path'.": 1,
"Dynamic access of 'pid'.": 1,
+3 -2
View File
@@ -112,7 +112,8 @@ class _FileResourceInfo extends _ReadWriteResourceInfo {
));
}
static Future<ServiceExtensionResponse> getOpenFiles(function, params) {
static Future<ServiceExtensionResponse> getOpenFiles(
String function, Map<String, String> params) {
assert(function == 'ext.dart.io.getOpenFiles');
final data = {
'type': 'OpenFileList',
@@ -125,7 +126,7 @@ class _FileResourceInfo extends _ReadWriteResourceInfo {
Map<String, dynamic> get fileInfoMap => fullValueMap;
static Future<ServiceExtensionResponse> getOpenFileInfoMapByID(
function, params) {
String function, Map<String, String> params) {
final id = int.parse(params['id']!);
final result = openFiles.containsKey(id) ? openFiles[id]!.fileInfoMap : {};
final jsonValue = json.encode(result);