pub struct NetworkImage {
pub url: String,
pub scale: f64,
pub headers: Option<HeaderMap>,
}Expand description
Decodes an image from a URL. Flutter NetworkImage.
The bytes come from the platform’s HTTP client (Platform::http),
which is NSURLSession on Apple’s systems and fetch in a browser; an app may give the
request headers and a scale. The image is cached by URL, scale and headers, so every widget
showing the same picture shares one fetch and one decode.
Fields§
§url: StringThe URL to fetch the image from.
scale: f64Linear pixels per logical point in the decoded image.
headers: Option<HeaderMap>The HTTP headers to send with the request.
Implementations§
Source§impl NetworkImage
impl NetworkImage
Sourcepub fn new(url: impl Into<String>) -> NetworkImage
pub fn new(url: impl Into<String>) -> NetworkImage
Creates a provider for the image at url at the natural scale.
Sourcepub fn scale(self, scale: f64) -> NetworkImage
pub fn scale(self, scale: f64) -> NetworkImage
Dart NetworkImage(scale:).
Sourcepub fn headers(self, headers: HeaderMap) -> NetworkImage
pub fn headers(self, headers: HeaderMap) -> NetworkImage
The headers the request carries, as Dart’s headers map.
Trait Implementations§
Source§impl Clone for NetworkImage
impl Clone for NetworkImage
Source§fn clone(&self) -> NetworkImage
fn clone(&self) -> NetworkImage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for NetworkImage
impl Debug for NetworkImage
Source§impl ImageProvider for NetworkImage
impl ImageProvider for NetworkImage
Source§fn key(&self, _configuration: &ImageConfiguration) -> ImageCacheKey
fn key(&self, _configuration: &ImageConfiguration) -> ImageCacheKey
What names this image in the cache. Flutter
obtainKey. Read moreSource§fn load_image(
&self,
app: &mut App,
key: &ImageCacheKey,
) -> Retained<Handle<ImageStreamCompleter>>
fn load_image( &self, app: &mut App, key: &ImageCacheKey, ) -> Retained<Handle<ImageStreamCompleter>>
Starts decoding, answering with the completer that will carry the frame. Flutter
loadImage. Read moreSource§fn resolve(
&self,
app: &mut App,
configuration: &ImageConfiguration,
) -> Retained<Handle<ImageStream>>
fn resolve( &self, app: &mut App, configuration: &ImageConfiguration, ) -> Retained<Handle<ImageStream>>
The stream for this image, sharing whatever the cache already has. Flutter
resolve.Auto Trait Implementations§
impl Forget for NetworkImage
impl Freeze for NetworkImagewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const [Pos] is !null: Freeze,
PhantomData<[Pos]>: Freeze,
PhantomData<Bucket<HeaderValue>>: Freeze,
PhantomData<ExtraValue<HeaderValue>>: Freeze,
impl Move for NetworkImage
impl RefUnwindSafe for NetworkImage
impl Send for NetworkImage
impl Sync for NetworkImage
impl Unpin for NetworkImage
impl UnsafeUnpin for NetworkImagewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const [Pos] is !null: UnsafeUnpin,
PhantomData<[Pos]>: UnsafeUnpin,
PhantomData<Bucket<HeaderValue>>: UnsafeUnpin,
PhantomData<ExtraValue<HeaderValue>>: UnsafeUnpin,
impl UnwindSafe for NetworkImagewhere
RawVecInner: UnwindSafe,
BoxRaw<[Pos]>: UnwindSafe,
*const u8: UnwindSafe,
Align8<*mut ()>: UnwindSafe,
&'static Vtable: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more