diff --git a/examples/flutter_gallery/macos/Flutter/Flutter-Debug.xcconfig b/examples/flutter_gallery/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b608..785633d3a8 100644 --- a/examples/flutter_gallery/macos/Flutter/Flutter-Debug.xcconfig +++ b/examples/flutter_gallery/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/examples/flutter_gallery/macos/Flutter/Flutter-Release.xcconfig b/examples/flutter_gallery/macos/Flutter/Flutter-Release.xcconfig index c2efd0b608..5fba960c3a 100644 --- a/examples/flutter_gallery/macos/Flutter/Flutter-Release.xcconfig +++ b/examples/flutter_gallery/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/flutter/lib/src/painting/image_cache.dart b/packages/flutter/lib/src/painting/image_cache.dart index 212bb9aca2..eb9c85704a 100644 --- a/packages/flutter/lib/src/painting/image_cache.dart +++ b/packages/flutter/lib/src/painting/image_cache.dart @@ -28,6 +28,43 @@ const int _kDefaultSizeBytes = 100 << 20; // 100 MiB /// /// A shared instance of this cache is retained by [PaintingBinding] and can be /// obtained via the [imageCache] top-level property in the [painting] library. +/// +/// {@tool sample} +/// +/// This sample shows how to supply your own caching logic and replace the +/// global [imageCache] varible. +/// +/// ```dart +/// /// This is the custom implementation of [ImageCache] where we can override +/// /// the logic. +/// class MyImageCache extends ImageCache { +/// @override +/// void clear() { +/// print("Clearing cache!"); +/// super.clear(); +/// } +/// } +/// +/// class MyWidgetsBinding extends WidgetsFlutterBinding { +/// @override +/// ImageCache createImageCache() => MyImageCache(); +/// } +/// +/// void main() { +/// // The constructor sets global variables. +/// MyWidgetsBinding(); +/// runApp(MyApp()); +/// } +/// +/// class MyApp extends StatelessWidget { +/// @override +/// Widget build(BuildContext context) { +/// return Container(); +/// } +/// } +/// ``` +/// {@end-tool} + class ImageCache { final Map _pendingImages = {}; final Map _cache = {};