image property

ImageProvider<Object>? get image

Implementation

ImageProvider? get image {
  if (_image != null) return _image;
  for (CSSFunctionalNotation method in functions) {
    if (method.name == 'url') {
      String url = method.args.isNotEmpty ? method.args[0] : '';
      if (url.isEmpty) {
        continue;
      }
      // Method may contain quotation mark, like ['"assets/foo.png"']
      url = removeQuotationMark(url);

      Uri uri = Uri.parse(url);
      if (url.isNotEmpty) {
        uri = controller.uriParser!.resolve(Uri.parse(baseHref ?? controller.url), uri);
        FlutterView ownerFlutterView = controller.ownerFlutterView;
        return _image = BoxFitImage(
          boxFit: renderStyle.backgroundSize.fit,
          url: uri,
          loadImage: _obtainImage,
            onImageLoad: (int naturalWidth, int naturalHeight, int frameCount) {
              if (frameCount > 1) {
                 renderStyle.target.forceToRepaintBoundary = true;
                 renderStyle.target.renderBoxModel!.invalidateBoxPainter();
              }
            },
          devicePixelRatio: ownerFlutterView.devicePixelRatio
        );
      }
    }
  }
  return null;
}