fetchRespondsSources method

  1. @override
dynamic fetchRespondsSources(
  1. String path
)
override

server 获取返回资源

Implementation

@override
fetchRespondsSources(String path) {
  dynamic res;
  for (var builder in builders) {
    res = builder.findBuilderResource(path);
    if (res != null) {
      break;
    }
  }

  if (res == null) {
    Map? sourceMsg = _fileCache[path];
    if (sourceMsg == null) {
      return null;
    } else {
      String path = LocalServerConfiguration.joinZipPathSync(
          sourceMsg['zipUrl'], sourceMsg['filePath']);
      File temFile = File(path);
      if (temFile.existsSync()) {
        return temFile.readAsBytesSync();
      } else {
        return null;
      }
    }
  }
  return res;
}