### Install Application Bundle Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/CMakeLists.txt This section defines the installation rules for the application bundle. It ensures a clean build directory, installs the executable, data files, libraries, and assets. ```cmake set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Application Executable Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs the main application executable to the runtime destination. This makes the application available for execution. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Install AOT Library for Release Builds Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library for 'Profile' and 'Release' build configurations. This optimizes application startup and runtime performance. ```cmake install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Library Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs the main Flutter library file to the application's library directory. This is a core component required for Flutter applications. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Configure Installation Prefix for Windows Bundles Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Sets the installation prefix for Windows builds to be next to the executable, facilitating in-place execution and Visual Studio integration. This ensures that all necessary files are deployed with the executable. ```cmake set(BUILD_BUNDLE_DIR "$") set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) endif() set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs any bundled native libraries required by plugins to the application's library directory. This ensures that plugins have access to their dependencies. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Install ICU Data File Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs the ICU data file, which is necessary for internationalization and localization, to the data directory of the application bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Installs the Flutter assets directory, which contains Flutter-specific resources like images and fonts, into the application's data directory. The directory is removed and re-copied on each build to prevent stale files. ```cmake set(FLUTTER_ASSET_DIR_NAME "flutter_assets") install(CODE " file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") " COMPONENT Runtime) install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Image Builder Example Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CHANGELOG.md Demonstrates how to use the `imageBuilder` property to customize the widget used to display the image. This allows for advanced control over image rendering, including animations and placeholders. ```dart CachedNetworkImage( imageUrl: "http://example.com/image.jpg", imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( image: DecorationImage( image: imageProvider, fit: BoxFit.cover, colorFilter: ColorFilter.mode(Colors.red, BlendMode.colorBurn)), ), ), placeholder: (context, url) => CircularProgressIndicator(), errorWidget: (context, url, error) => Icon(Icons.error), ); ``` -------------------------------- ### Install Native Assets Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Copies native assets provided by the build process into the application's library directory. These assets are often required by platform-specific code or plugins. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Set Flutter Library and Headers Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/flutter/CMakeLists.txt Defines the Flutter library path and headers, publishing them to the parent scope for use in installation steps. ```cmake set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) ``` -------------------------------- ### Web Image Rendering Options Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CHANGELOG.md Configure how images are rendered on the web. The default uses the standard HTML ImageElement, but you can opt for a custom HTTP Get for headers and Skia support for advanced use cases. ```dart CachedNetworkImage( imageUrl: 'https://example.com/image.jpg', httpHeaders: { 'custom-header': 'value', }, ); ``` -------------------------------- ### Cached Network Image with Progress Indicator Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/README.md This example shows how to display a CircularProgressIndicator that updates with the download progress of the image. It also includes an error widget for failed loads. ```dart CachedNetworkImage( imageUrl: "http://via.placeholder.com/350x150", progressIndicatorBuilder: (context, url, downloadProgress) => CircularProgressIndicator(value: downloadProgress.progress), errorWidget: (context, url, error) => Icon(Icons.error), ) ``` -------------------------------- ### Install AOT Library on Non-Debug Builds (CMake) Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/CMakeLists.txt Installs the AOT library to the specified destination only when the build type is not Debug. This ensures AOT compilation artifacts are included in release builds. ```cmake if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Using CachedNetworkImageProvider Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/README.md Demonstrates how to use CachedNetworkImageProvider to get an ImageProvider that can be used with the standard Flutter Image widget. Note that web support for caching is minimal. ```dart Image(image: CachedNetworkImageProvider(url)) ``` -------------------------------- ### CachedNetworkImage with Custom Image Builder Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Use a custom image builder to customize how the loaded image is displayed, for example, within a CircleAvatar. This provides the ImageProvider to the builder. ```dart // Custom image builder — get the ImageProvider to use inside another widget CachedNetworkImage( imageUrl: 'https://via.placeholder.com/300x300', placeholder: (context, url) => const CircleAvatar( backgroundColor: Colors.grey, radius: 75, ), imageBuilder: (context, imageProvider) => CircleAvatar( backgroundImage: imageProvider, radius: 75, ), errorWidget: (context, url, error) => const Icon(Icons.error), ) ``` -------------------------------- ### Run unit tests Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Verify that your changes have not introduced any regressions by running the project's unit tests. ```bash flutter test ``` -------------------------------- ### Configure Flutter Library and Dependencies Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Sets up the Flutter library, ICU data file, and project build directory. It also finds and configures system-level dependencies like GTK, GLIB, and GIO using PkgConfig. ```cmake find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") # Published to parent scope for install step. set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) ``` -------------------------------- ### Run static analyses Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Check for potential issues and code quality problems by running static analysis on the project. ```bash flutter analyze ``` -------------------------------- ### Configure Runtime Output Directory Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/CMakeLists.txt This sets the runtime output directory for the application's executable. It places the executable in a subdirectory to ensure correct resource loading when bundled. ```cmake set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) ``` -------------------------------- ### Clone the forked repository Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Clone your forked repository to your local development machine. Replace `` with your GitHub username. ```bash git clone git@github.com:/flutter_cached_network_image.git ``` -------------------------------- ### Enable Unicode Support Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Adds definitions to enable Unicode support for all projects. This ensures proper handling of international characters. ```cmake add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Include Runner Subdirectory Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Includes the 'runner' subdirectory, which likely contains the main application entry point and specific build configurations for the runner executable. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Set CMake Minimum Version and Project Name Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Specifies the minimum required CMake version and names the project. This is a standard CMakeLists.txt header. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) ``` -------------------------------- ### Define Application Executable Target Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/CMakeLists.txt This section defines the main executable for the application, listing its source files. It also applies standard build settings and links necessary libraries. ```cmake add_executable(${BINARY_NAME} "main.cc" "my_application.cc" "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" ) apply_standard_settings(${BINARY_NAME}) target_link_libraries(${BINARY_NAME} PRIVATE flutter) target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) add_dependencies(${BINARY_NAME} flutter_assemble) ``` -------------------------------- ### Format code Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Ensure your code adheres to the project's formatting standards by running the Flutter formatter. ```bash flutter format . ``` -------------------------------- ### Flutter Tool Backend Assembly Command Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/flutter/CMakeLists.txt Configures a custom command to assemble the Flutter library and related files using the Flutter tool backend. A phony output file is used to ensure the command runs on every build. ```cmake # _phony_ is a non-existent file to force this command to run every time, since currently there's no way to get a full input/output list from the flutter tool. set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ${PHONY_OUTPUT} COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ${CPP_WRAPPER_SOURCES_APP} ) ``` -------------------------------- ### CachedNetworkImage with Authentication and Cache Limits Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Configure authentication headers, disk cache size limits (maxWidthDiskCache, maxHeightDiskCache), and custom fade transition durations and curves for network images. ```dart // With authentication headers, disk cache size limit, and custom fade duration CachedNetworkImage( imageUrl: 'https://example.com/protected-image.jpg', httpHeaders: const {'Authorization': 'Bearer my-token'}, maxWidthDiskCache: 800, maxHeightDiskCache: 600, fadeInDuration: const Duration(milliseconds: 300), fadeOutDuration: const Duration(milliseconds: 500), fadeInCurve: Curves.easeInOut, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.broken_image), ) ``` -------------------------------- ### Basic Cached Network Image with Placeholder Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/README.md Use this snippet to display an image from a URL with a placeholder widget shown while the image is loading. An error widget is displayed if the image fails to load. ```dart CachedNetworkImage( imageUrl: "http://via.placeholder.com/350x150", placeholder: (context, url) => CircularProgressIndicator(), errorWidget: (context, url, error) => Icon(Icons.error), ) ``` -------------------------------- ### Web image rendering with HttpGet Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Employ `ImageRenderMethodForWeb.HttpGet` on the web to fetch image bytes via HTTP, enabling custom headers and CanvasKit rendering, but bypassing browser-level caching. ```dart // HttpGet — supports Authorization headers on web and CanvasKit rendering CachedNetworkImage( imageUrl: 'https://example.com/authenticated-image.jpg', httpHeaders: const {'Authorization': 'Bearer my-token'}, imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.error), ) ``` -------------------------------- ### Define Standard Build Settings Function Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/CMakeLists.txt This function applies common compilation features, options, and definitions to a target. It's used to ensure consistent build settings across different targets. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_14) target_compile_options(${TARGET} PRIVATE -Wall -Werror) target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") endfunction() ``` -------------------------------- ### Include Generated Plugin Build Rules Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Includes the CMake script that manages the building of generated plugins and integrates them into the application. This is essential for plugin functionality. ```cmake include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Define and Use a Custom CacheManager Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Define a custom singleton cache manager extending CacheManager and ImageCacheManager. Use it in CachedNetworkImage for disk resizing and in CachedNetworkImageProvider. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; // Define a custom singleton cache manager class ThumbnailCacheManager extends CacheManager with ImageCacheManager { static const key = 'thumbnailCache'; static final ThumbnailCacheManager _instance = ThumbnailCacheManager._(); factory ThumbnailCacheManager() => _instance; ThumbnailCacheManager._() : super( Config( key, stalePeriod: const Duration(days: 7), maxNrOfCacheObjects: 200, ), ); } // Use the custom manager in a widget — disk resize requires ImageCacheManager CachedNetworkImage( imageUrl: 'https://example.com/large-photo.jpg', cacheManager: ThumbnailCacheManager(), maxWidthDiskCache: 200, // resize and store at 200 px wide on disk maxHeightDiskCache: 200, memCacheWidth: 200, // also constrain in-memory image cache memCacheHeight: 200, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.error), ) // Share the same manager with an ImageProvider const Image( image: CachedNetworkImageProvider( 'https://example.com/large-photo.jpg', cacheManager: ThumbnailCacheManager(), maxWidth: 200, maxHeight: 200, ), ) ``` -------------------------------- ### Define Static Library for Plugin Wrapper Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/flutter/CMakeLists.txt Defines a static library for the C++ client wrapper used by plugins, including core and plugin-specific sources. ```cmake list(APPEND CPP_WRAPPER_SOURCES_CORE "core_implementations.cc" "standard_codec.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_PLUGIN "plugin_registrar.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") list(APPEND CPP_WRAPPER_SOURCES_APP "flutter_engine.cc" "flutter_view_controller.cc" ) list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") # Wrapper sources needed for a plugin. add_library(flutter_wrapper_plugin STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} ) apply_standard_settings(flutter_wrapper_plugin) set_target_properties(flutter_wrapper_plugin PROPERTIES POSITION_INDEPENDENT_CODE ON) set_target_properties(flutter_wrapper_plugin PROPERTIES CXX_VISIBILITY_PRESET hidden) target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) target_include_directories(flutter_wrapper_plugin PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_plugin flutter_assemble) ``` -------------------------------- ### Configure Flutter Library Interface Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/flutter/CMakeLists.txt Configures the Flutter library interface, including include directories and linking against the Flutter library. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "flutter_export.h" "flutter_windows.h" "flutter_messenger.h" "flutter_plugin_registrar.h" "flutter_texture_registrar.h" ) list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### Custom Build Command for Flutter Tool Backend Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Defines a custom command to generate the Flutter library and headers using the Flutter tool backend script. It uses a phony output file to ensure the command runs on every build. ```cmake add_custom_command( OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/_phony_ COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} VERBATIM ) ``` -------------------------------- ### Define Static Library for Runner Wrapper Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/flutter/CMakeLists.txt Defines a static library for the C++ client wrapper used by the runner application, including core and app-specific sources. ```cmake # Wrapper sources needed for the runner. add_library(flutter_wrapper_app STATIC ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_APP} ) apply_standard_settings(flutter_wrapper_app) target_link_libraries(flutter_wrapper_app PUBLIC flutter) target_include_directories(flutter_wrapper_app PUBLIC "${WRAPPER_ROOT}/include" ) add_dependencies(flutter_wrapper_app flutter_assemble) ``` -------------------------------- ### Define Profile Build Mode Linker and Compiler Flags Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Sets linker and compiler flags for the 'Profile' build mode, typically inheriting settings from the 'Release' mode. This ensures consistent performance optimizations for profiling builds. ```cmake set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") ``` -------------------------------- ### Create Flutter Interface Library Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Defines an INTERFACE library target named 'flutter'. It sets include directories, links against the Flutter shared object and PkgConfig libraries (GTK, GLIB, GIO), and adds a dependency on the 'flutter_assemble' target. ```cmake add_library(flutter INTERFACE) target_include_directories(flutter INTERFACE "${EPHEMERAL_DIR}" ) target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") target_link_libraries(flutter INTERFACE PkgConfig::GTK PkgConfig::GLIB PkgConfig::GIO ) add_dependencies(flutter flutter_assemble) ``` -------------------------------- ### GridView with Custom CacheManager Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Display a grid of thumbnails using CachedNetworkImage and a shared custom cache manager. Disk resizing is enabled for optimized storage. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; // Grid of thumbnails using a shared custom cache manager GridView.builder( itemCount: 100, gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 3, crossAxisSpacing: 4, mainAxisSpacing: 4, ), itemBuilder: (context, index) => CachedNetworkImage( imageUrl: 'https://picsum.photos/seed/$index/150/150', cacheManager: ThumbnailCacheManager(), maxWidthDiskCache: 150, maxHeightDiskCache: 150, placeholder: (context, url) => const Center(child: CircularProgressIndicator(strokeWidth: 2)), errorWidget: (context, url, error) => const Center(child: Icon(Icons.error)), fit: BoxFit.cover, ), ) ``` -------------------------------- ### Configure Build Types for Multi-Config Generators Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Defines the available build configurations (Debug, Profile, Release) when using a multi-configuration CMake generator. This ensures consistent build options across different configurations. ```cmake get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTICONFIG) set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" CACHE STRING "" FORCE) else() if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Flutter build mode" FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Profile" "Release") endif() endif() ``` -------------------------------- ### Fetch upstream and create a new branch Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Fetch the latest code from the upstream repository and create a new branch for your contributions. This keeps your work isolated and up-to-date with the main development branch. ```bash git fetch upstream git checkout upstream/develop -b ``` -------------------------------- ### Use Custom Cache Key Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CHANGELOG.md Provide a custom cache key that is different from the image URL. This allows for more flexible cache management, especially when the same image might be referenced by different URLs. ```dart CachedNetworkImage( key: ValueKey('my-custom-key'), imageUrl: 'https://example.com/image.jpg', ); ``` -------------------------------- ### Commit changes Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Commit your changes with an informative message. This message should clearly describe the changes you have made. ```bash git commit -am "" ``` -------------------------------- ### Basic CachedNetworkImage Usage Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Use this for standard image loading with a placeholder and an error widget. Specify image URL, placeholder, error widget, and dimensions. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; // Basic usage with placeholder and error widget CachedNetworkImage( imageUrl: 'https://via.placeholder.com/350x150', placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.error), width: 350, height: 150, fit: BoxFit.cover, ) ``` -------------------------------- ### Web image rendering with HtmlImage Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Use `ImageRenderMethodForWeb.HtmlImage` for default web rendering, leveraging the browser's native `` element and its caching. This method does not support custom HTTP headers. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart'; // Default: HtmlImage — browser-native rendering, no custom headers on web CachedNetworkImage( imageUrl: 'https://example.com/public-image.jpg', imageRenderMethodForWeb: ImageRenderMethodForWeb.HtmlImage, placeholder: (context, url) => const CircularProgressIndicator(), ) ``` -------------------------------- ### Opt-in to Modern CMake Behaviors Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Explicitly enables modern CMake behaviors to prevent warnings in newer CMake versions. This ensures compatibility and adherence to current CMake standards. ```cmake cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Add Flutter Library Headers Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Appends a list of Flutter library header files to a variable and then prepends the ephemeral directory path to each header using the custom list_prepend function. ```cmake list(APPEND FLUTTER_LIBRARY_HEADERS "fl_basic_message_channel.h" "fl_binary_codec.h" "fl_binary_messenger.h" "fl_dart_project.h" "fl_engine.h" "fl_json_message_codec.h" "fl_json_method_codec.h" "fl_message_codec.h" "fl_method_call.h" "fl_method_channel.h" "fl_method_codec.h" "fl_method_response.h" "fl_plugin_registrar.h" "fl_plugin_registry.h" "fl_standard_message_codec.h" "fl_standard_method_codec.h" "fl_string_codec.h" "fl_value.h" "fl_view.h" "flutter_linux.h" ) list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") ``` -------------------------------- ### Apply Standard Compilation Settings Function Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Defines a reusable function to apply standard compilation settings to a target. This includes setting the C++ standard, warning levels, and specific compile definitions. ```cmake function(APPLY_STANDARD_SETTINGS TARGET) target_compile_features(${TARGET} PUBLIC cxx_std_17) target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") target_compile_options(${TARGET} PRIVATE /EHsc) target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") endfunction() ``` -------------------------------- ### CachedNetworkImageProvider with advanced options Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Configure CachedNetworkImageProvider with custom headers, cache keys, scale, dimensions, and error listeners for fine-grained control. ```dart // With headers, custom cache key, and scale CachedNetworkImageProvider( 'https://example.com/image.jpg', headers: const {'Authorization': 'Bearer token'}, cacheKey: 'my-unique-cache-key', scale: 2.0, maxWidth: 800, maxHeight: 600, errorListener: (error) => debugPrint('Provider error: $error'), ) ``` -------------------------------- ### Push changes to fork Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Push your committed changes to your fork on GitHub. Replace `` with the name of the branch you created. ```bash git push origin ``` -------------------------------- ### Define Executable Binary Name Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Sets the name of the executable file for the application. This can be modified to change the application's on-disk name. ```cmake set(BINARY_NAME "example") ``` -------------------------------- ### CachedNetworkImage with Progress Indicator Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Display a CircularProgressIndicator that shows the download progress percentage. Requires the `progressIndicatorBuilder` callback. ```dart // Progress indicator showing download percentage CachedNetworkImage( imageUrl: 'https://via.placeholder.com/350x150', progressIndicatorBuilder: (context, url, downloadProgress) => CircularProgressIndicator(value: downloadProgress.progress), errorWidget: (context, url, error) => const Icon(Icons.error), ) ``` -------------------------------- ### Include Flutter Managed Directory Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/windows/CMakeLists.txt Adds the Flutter managed directory to the build. This is typically where Flutter's build system and libraries are located. ```cmake set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) ``` -------------------------------- ### Use per-instance custom cache manager Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Specify a custom cache manager for a specific CachedNetworkImageProvider instance by passing it via the `cacheManager` parameter. ```dart // Use a per-instance custom cache manager CachedNetworkImageProvider( 'https://example.com/image.jpg', cacheManager: CustomCacheManager.instance, ) ``` -------------------------------- ### Cached Network Image with Custom Image Builder Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/README.md This snippet utilizes the imageBuilder to provide a custom widget that receives the loaded image as an ImageProvider. This allows for advanced decoration and manipulation of the displayed image, alongside placeholder and error widgets. ```dart CachedNetworkImage( imageUrl: "http://via.placeholder.com/200x150", imageBuilder: (context, imageProvider) => Container( decoration: BoxDecoration( image: DecorationImage( image: imageProvider, fit: BoxFit.cover, colorFilter: ColorFilter.mode(Colors.red, BlendMode.colorBurn)), ), ), placeholder: (context, url) => CircularProgressIndicator(), errorWidget: (context, url, error) => Icon(Icons.error), ) ``` -------------------------------- ### CachedNetworkImageProvider web rendering with HttpGet Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Configure `CachedNetworkImageProvider` to use `ImageRenderMethodForWeb.HttpGet` for fetching images on the web, allowing for custom headers. ```dart // Same option available on CachedNetworkImageProvider const CachedNetworkImageProvider( 'https://example.com/image.jpg', imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, headers: {'Authorization': 'Bearer my-token'}, ) ``` -------------------------------- ### Evict image from cache using custom cache key Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Evict an image from the cache by providing a specific `cacheKey` instead of the URL. This is useful when the cache key differs from the image URL. ```dart // Evict using a custom cache key await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', cacheKey: 'my-unique-cache-key', ); ``` -------------------------------- ### Resize Images in Disk Cache Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CHANGELOG.md Specify the maximum height for images stored in the disk cache to manage storage space. This is useful for optimizing cache size. ```dart CachedNetworkImage( maxHeightDiskCache: 200, imageUrl: 'https://via.placeholder.com/3000x2000', ); ``` -------------------------------- ### Add upstream remote Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CONTRIBUTING.md Add an upstream remote to the original repository to fetch updates from the main project. This ensures you are working with the latest code. ```bash git remote add upstream git@github.com:baseflow/flutter_cached_network_image.git ``` -------------------------------- ### ListView with CachedNetworkImage Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Efficiently display cached images in a ListView. Each item uses CachedNetworkImage with a placeholder and error widget. Repeated instances with the same URL share in-memory cache entries. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; // Infinite-scroll list with per-item placeholder color ListView.builder( itemCount: 100, itemBuilder: (context, index) => Card( child: CachedNetworkImage( imageUrl: 'https://picsum.photos/seed/$index/320/240', placeholder: (context, url) => Container( width: 320, height: 240, color: Colors.grey.shade200, ), errorWidget: (context, url, error) => const Icon(Icons.broken_image, size: 48), fit: BoxFit.cover, ), ), ) ``` -------------------------------- ### Define list_prepend function in CMake Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Defines a custom CMake function to prepend an element to a list, as the standard 'list(TRANSFORM ... PREPEND ...)' is not available in CMake version 3.10. ```cmake function(list_prepend LIST_NAME PREFIX) set(NEW_LIST "") foreach(element ${${LIST_NAME}}) list(APPEND NEW_LIST "${PREFIX}${element}") endforeach(element) set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) endfunction() ``` -------------------------------- ### CachedNetworkImage with Error Listener Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Implement an error listener to programmatically handle image loading failures. The listener receives the error object for debugging or custom actions. ```dart // Error listener for programmatic error handling CachedNetworkImage( imageUrl: 'https://example.com/maybe-missing.jpg', placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.error), errorListener: (error) { debugPrint('Image failed to load: ${error.runtimeType} — $error'); }, ) ``` -------------------------------- ### Create Flutter Assemble Custom Target Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/example/linux/flutter/CMakeLists.txt Creates a custom target named 'flutter_assemble' that depends on the generated Flutter library and its headers. This target ensures that the Flutter library is built before other targets that depend on it. ```cmake add_custom_target(flutter_assemble DEPENDS "${FLUTTER_LIBRARY}" ${FLUTTER_LIBRARY_HEADERS} ) ``` -------------------------------- ### Evict image from cache using specific cache manager Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Evict an image from the cache using a particular `BaseCacheManager` instance. This allows for targeted cache management when multiple managers are in use. ```dart // Evict using a specific cache manager instance await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', cacheManager: CustomCacheManager.instance, scale: 1.0, ); ``` -------------------------------- ### CachedNetworkImage.evictFromCache Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Static method to remove an image from both the disk cache and Flutter's in-memory ImageCache. This forces a fresh download on the next load or frees up storage. ```APIDOC ## CachedNetworkImage.evictFromCache Static method that removes an image from both the disk cache managed by `BaseCacheManager` and the in-memory `ImageCache` maintained by Flutter's painting layer. Use this to force a fresh download on next load or to free up storage. ### Usage Examples **Evict by URL (uses default cache manager):** ```dart import 'package:cached_network_image/cached_network_image.dart'; final bool removed = await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', ); debugPrint('Evicted: $removed'); // true if the image was in cache ``` **Evict using a custom cache key:** ```dart await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', cacheKey: 'my-unique-cache-key', ); ``` **Evict using a specific cache manager instance:** ```dart await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', cacheManager: CustomCacheManager.instance, scale: 1.0, ); ``` ``` -------------------------------- ### Evict image from cache by URL Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Remove an image from the cache using its URL. This method uses the default cache manager and returns a boolean indicating if the eviction was successful. ```dart import 'package:cached_network_image/cached_network_image.dart'; // Evict by URL (uses default cache manager) final bool removed = await CachedNetworkImage.evictFromCache( 'https://via.placeholder.com/350x150', ); debugPrint('Evicted: $removed'); // true if the image was in cache ``` -------------------------------- ### Use CachedNetworkImageProvider in BoxDecoration Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Integrate CachedNetworkImageProvider within a BoxDecoration's DecorationImage for background images in Flutter widgets. ```dart // Use inside a DecorationImage for BoxDecoration backgrounds Container( width: 300, height: 200, decoration: BoxDecoration( image: DecorationImage( image: const CachedNetworkImageProvider( 'https://via.placeholder.com/300x200', ), fit: BoxFit.cover, ), borderRadius: BorderRadius.circular(12), ), ) ``` -------------------------------- ### CachedNetworkImage with Color Blend Overlay Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Apply a color blend overlay to the loaded image using the `color` and `colorBlendMode` properties, similar to Flutter's standard Image widget. ```dart // Color blend overlay CachedNetworkImage( imageUrl: 'https://via.placeholder.com/300x150', color: Colors.red.withOpacity(0.5), colorBlendMode: BlendMode.colorBurn, placeholder: (context, url) => const CircularProgressIndicator(), ) ``` -------------------------------- ### ImageRenderMethodForWeb enum Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Controls how images are fetched and rendered on Flutter Web. Options include HtmlImage (default) for native browser rendering or HttpGet for custom headers and Skia/CanvasKit rendering. ```APIDOC ## ImageRenderMethodForWeb enum Controls how images are fetched and rendered on the Flutter Web platform. `HtmlImage` (default) delegates to the browser's native `` element and its built-in caching. `HttpGet` fetches the image bytes via an HTTP client, enabling custom headers and Skia/CanvasKit rendering but bypassing browser-level caching. ### Usage Examples **Default: HtmlImage:** ```dart import 'package:cached_network_image/cached_network_image.dart'; CachedNetworkImage( imageUrl: 'https://example.com/public-image.jpg', imageRenderMethodForWeb: ImageRenderMethodForWeb.HtmlImage, placeholder: (context, url) => const CircularProgressIndicator(), ) ``` **HttpGet - supports Authorization headers on web and CanvasKit rendering:** ```dart CachedNetworkImage( imageUrl: 'https://example.com/authenticated-image.jpg', httpHeaders: const {'Authorization': 'Bearer my-token'}, imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, placeholder: (context, url) => const CircularProgressIndicator(), errorWidget: (context, url, error) => const Icon(Icons.error), ) ``` **Same option available on CachedNetworkImageProvider:** ```dart const CachedNetworkImageProvider( 'https://example.com/image.jpg', imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, headers: {'Authorization': 'Bearer my-token'}, ) ``` ``` -------------------------------- ### Use CachedNetworkImageProvider with Image widget Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Use CachedNetworkImageProvider directly with the standard Flutter Image widget to load and cache network images. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; // Use directly with Image widget const Image( image: CachedNetworkImageProvider('https://via.placeholder.com/350x150'), ) ``` -------------------------------- ### CachedNetworkImageProvider Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt An ImageProvider that loads and caches images from the network. It can be used anywhere Flutter's standard Image widget or DecorationImage accepts an ImageProvider. ```APIDOC ## CachedNetworkImageProvider `CachedNetworkImageProvider` is an `ImageProvider` that can be used anywhere Flutter's standard `Image` widget or `DecorationImage` accepts an `ImageProvider`. It loads and caches the image from the network and supports all the same caching options as the widget. ### Usage Examples **Use directly with Image widget:** ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; const Image( image: CachedNetworkImageProvider('https://via.placeholder.com/350x150'), ) ``` **Use inside a DecorationImage for BoxDecoration backgrounds:** ```dart Container( width: 300, height: 200, decoration: BoxDecoration( image: DecorationImage( image: const CachedNetworkImageProvider( 'https://via.placeholder.com/300x200', ), fit: BoxFit.cover, ), borderRadius: BorderRadius.circular(12), ), ) ``` **With headers, custom cache key, and scale:** ```dart CachedNetworkImageProvider( 'https://example.com/image.jpg', headers: const {'Authorization': 'Bearer token'}, cacheKey: 'my-unique-cache-key', scale: 2.0, maxWidth: 800, maxHeight: 600, errorListener: (error) => debugPrint('Provider error: $error'), ) ``` **Override the default cache manager globally:** ```dart CachedNetworkImageProvider.defaultCacheManager = CustomCacheManager.instance; ``` **Use a per-instance custom cache manager:** ```dart CachedNetworkImageProvider( 'https://example.com/image.jpg', cacheManager: CustomCacheManager.instance, ) ``` ``` -------------------------------- ### Set Cache Manager Log Level Source: https://github.com/baseflow/flutter_cached_network_image/blob/develop/cached_network_image/CHANGELOG.md Configure the log level for the cache manager to control the verbosity of debug messages. Use this to adjust logging during development or production. ```dart CachedNetworkImage.logLevel = CacheManagerLogLevel.debug; ``` -------------------------------- ### CachedNetworkImage.logLevel Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Static getter and setter to control the log verbosity of the underlying flutter_cache_manager. Useful for debugging cache operations. ```APIDOC ## CachedNetworkImage.logLevel Static getter and setter controlling the log verbosity of the underlying `flutter_cache_manager`. Useful for debugging cache hits, misses, and download activity during development. ### Usage Examples **Enable verbose debug logging:** ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; void main() { // Enable verbose debug logging before the app starts CachedNetworkImage.logLevel = CacheManagerLogLevel.debug; // Read the current level final CacheManagerLogLevel level = CachedNetworkImage.logLevel; debugPrint('Cache log level: $level'); // Disable all logging for production CachedNetworkImage.logLevel = CacheManagerLogLevel.none; runApp(const MyApp()); } ``` ``` -------------------------------- ### Override default cache manager globally Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Globally override the default cache manager used by CachedNetworkImageProvider by assigning a custom instance to `CachedNetworkImageProvider.defaultCacheManager`. ```dart // Override the default cache manager globally CachedNetworkImageProvider.defaultCacheManager = CustomCacheManager.instance; ``` -------------------------------- ### Control CachedNetworkImage log level Source: https://context7.com/baseflow/flutter_cached_network_image/llms.txt Set the `CachedNetworkImage.logLevel` to control the verbosity of logs from the `flutter_cache_manager`. Useful for debugging cache operations. ```dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; void main() { // Enable verbose debug logging before the app starts CachedNetworkImage.logLevel = CacheManagerLogLevel.debug; // Read the current level final CacheManagerLogLevel level = CachedNetworkImage.logLevel; debugPrint('Cache log level: $level'); // Disable all logging for production CachedNetworkImage.logLevel = CacheManagerLogLevel.none; runApp(const MyApp()); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.