toImageProvider static method

ImageProvider<Object> toImageProvider(
  1. MediaProvider provider
)

Implementation

static ImageProvider toImageProvider(MediaProvider provider) {
  if (provider is MemoryMediaProvider) {
    return MemoryImage(provider.data);
  } else if (provider is UrlMediaProvider) {
    return NetworkImage(provider.url);
  } else if (provider is AssetMediaProvider) {
    return AssetImage(provider.assetName);
  } else {
    throw StateError('Unsupported media provider $provider');
  }
}