DiagramImageCache constructor
DiagramImageCache({})
Implementation
DiagramImageCache({
this.provider,
int maximumConcurrentLoads =
DiagramImageConfiguration.defaultMaximumConcurrentLoads,
this.maximumDecodedBytes,
int retentionBytes = DiagramImageConfiguration.defaultRetentionBytes,
Duration loadTimeout = DiagramImageConfiguration.defaultLoadTimeout,
}) : _maximumConcurrentLoads = maximumConcurrentLoads,
_retentionBytes = retentionBytes,
_loadTimeout = loadTimeout {
if (retentionBytes <= 0) {
throw ArgumentError.value(
retentionBytes,
'retentionBytes',
'must be positive',
);
}
if (maximumDecodedBytes != null && maximumDecodedBytes! <= 0) {
throw ArgumentError.value(
maximumDecodedBytes,
'maximumDecodedBytes',
'must be positive',
);
}
if (loadTimeout <= Duration.zero) {
throw ArgumentError.value(loadTimeout, 'loadTimeout', 'must be positive');
}
if (maximumConcurrentLoads < 1) {
throw ArgumentError.value(
maximumConcurrentLoads,
'maximumConcurrentLoads',
'must be positive',
);
}
}