source property

String get source

Gets or sets the Picture's source URL, which can be any valid image (png, jpg, gif, etc) URL.

The default value is the empty string, which specifies no image source. Setting this attribute creates an HTMLImageElement and sets the Picture#element attribute to that element. When the element loads, this Picture may remeasure if no GraphObject#desiredSize was set, and Diagrams using the picture will redraw.

To avoid remeasuring and rearranging Parts as images load asynchronously, be sure to set the GraphObject#desiredSize (or GraphObject#width and GraphObject#height) to fixed values.

Setting the source of multiple Pictures to the same URL will cause only one HTMLImageElement to be created and shared. Setting the source to the empty string will set Picture#element to null. It is commonplace to either specify a constant URL or to data bind this property to some data property, perhaps using a conversion function in order to produce a proper URL.

For cross-browser support of SVG sources additional care is needed. See the final section of the Introduction page on Pictures.

Implementation

_i2.String get source => _i4.getProperty(
      this,
      'source',
    );
set source (String value)

Implementation

set source(_i2.String value) {
  _i4.setProperty(
    this,
    'source',
    value,
  );
}