From 26f9d734e9f493e152318b5fe1be45df92528a39 Mon Sep 17 00:00:00 2001 From: Juyeong Lee <2jy22@naver.com> Date: Thu, 30 Jul 2020 13:31:03 +0900 Subject: [PATCH] Update image docs that Image.file() cashes file (#62301) --- packages/flutter/lib/src/painting/image_provider.dart | 3 +++ packages/flutter/lib/src/widgets/image.dart | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/packages/flutter/lib/src/painting/image_provider.dart b/packages/flutter/lib/src/painting/image_provider.dart index fb4f480ad5..d33a51fd80 100644 --- a/packages/flutter/lib/src/painting/image_provider.dart +++ b/packages/flutter/lib/src/painting/image_provider.dart @@ -837,6 +837,9 @@ abstract class NetworkImage extends ImageProvider { /// Decodes the given [File] object as an image, associating it with the given /// scale. /// +/// The provider does not monitor the file for changes. If you expect the +/// underlying data to change, you should call the [evict] method. +/// /// See also: /// /// * [Image.file] for a shorthand of an [Image] widget backed by [FileImage]. diff --git a/packages/flutter/lib/src/widgets/image.dart b/packages/flutter/lib/src/widgets/image.dart index f6ac06beaf..f4db8f7a01 100644 --- a/packages/flutter/lib/src/widgets/image.dart +++ b/packages/flutter/lib/src/widgets/image.dart @@ -436,6 +436,15 @@ class Image extends StatefulWidget { /// will be rendered to the constraints of the layout or [width] and [height] /// regardless of these parameters. These parameters are primarily intended /// to reduce the memory usage of [ImageCache]. + /// + /// Loading an image from a file creates an in memory copy of the file, + /// which is retained in the [ImageCache]. The underlying file is not + /// monitored for changes. If it does change, the application should evict + /// the entry from the [ImageCache]. + /// + /// See also: + /// + /// * [FileImage] provider for evicting the underlying file easily. Image.file( File file, { Key key,