### Installation Directory Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/windows/CMakeLists.txt Configures installation directories for runtime components, ensuring support files are placed next to 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}") ``` -------------------------------- ### Installation Directory Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Configures installation directories for the application bundle, including data and library paths, and sets the install prefix to the executable's directory for in-place running. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. 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}") ``` -------------------------------- ### Installation Paths and Target Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/linux/CMakeLists.txt Defines installation directories for data and libraries within the bundle and installs the main application executable. ```cmake 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) ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/api/amplify_api/example/linux/CMakeLists.txt Sets the minimum CMake version and project name for the application. This is a standard starting point for CMake projects. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) ``` -------------------------------- ### Installing Application Executable Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs the application executable to the root of the installation bundle. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) ``` -------------------------------- ### Run Amplify Kinesis Example App Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_kinesis/example/README.md Navigate to the example directory and run the Flutter application. ```bash cd packages/kinesis/amplify_kinesis/example flutter run ``` -------------------------------- ### Installing Application Targets and Files Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Installs the main executable, ICU data, Flutter library, and any bundled plugin libraries to their designated locations within the installation bundle. ```cmake 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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Example Configuration in Changelog Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/aft/test/commands/fixtures/get_release_notes/code_block_changelog.md Illustrates an example configuration within a markdown code block in the changelog. ```markdown ## This heading is inside a code block And should not terminate the section. ``` -------------------------------- ### Installing Application and Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/templates/flutter-package/__brick__/example/linux/CMakeLists.txt Installs the application executable, ICU data, Flutter library, and bundled plugin libraries to the specified installation directories. ```cmake 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) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Install Application Target and Files Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/auth/amplify_auth_cognito/example/linux/CMakeLists.txt Installs the main application executable, Flutter ICU data, Flutter library, and any bundled plugin libraries to their respective destinations within the installation bundle. This prepares the application for deployment. ```cmake 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) ``` -------------------------------- ### Install Dependencies Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra-gen2/readme.md Install project dependencies before running the deployment script. This command is typically run once. ```bash npm i ``` -------------------------------- ### Installation Bundle Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Configures the installation prefix to create a relocatable bundle and ensures a clean build bundle directory on each build. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. 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() # Start with a clean build bundle directory every time. 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") ``` -------------------------------- ### Installation Code - Clean Build Bundle Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/linux/CMakeLists.txt Cleans the build bundle directory before installation to ensure a fresh state. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. 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() # Start with a clean build bundle directory every time. install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Setup Project Dependencies Source: https://github.com/aws-amplify/amplify-flutter/blob/main/AGENTS.md Update git submodules and activate the Amplify Flutter Tool (aft) for project bootstrapping. ```bash git submodule update --init --recursive dart pub global activate -spath packages/aft aft bootstrap ``` -------------------------------- ### Upgrade Get URL Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/README.md Presents the updated way to generate a URL for a storage item. The new API returns an operation object, and the URL is accessed via the `.result` property. ```dart // before final result = await Amplify.Storage.getUrl(key: 'ExampleKey'); print('Got url: ${result.url}'); // after final result = await Amplify.Storage.getUrl(key: 'ExampleKey').result; print('Got url: ${result.url.toString()}'); ``` -------------------------------- ### Defining Installation Directories Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Sets variables for the installation directories within the bundle for data and libraries. ```cmake set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") ``` -------------------------------- ### Installing Flutter Library and Bundled Libraries Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/example/linux/CMakeLists.txt Installs the main Flutter library and any bundled libraries provided by plugins into the 'lib' directory of the installation bundle. ```cmake 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) ``` -------------------------------- ### Run Integration Tests for Amplify Auth Cognito Source: https://github.com/aws-amplify/amplify-flutter/blob/main/CONTRIBUTING.md Example command to run integration tests specifically for the amplify_auth_cognito plugin. This requires the corresponding example app to be set up. ```bash $ aft exec flutter test integration_test --include amplify_auth_cognito_example ``` -------------------------------- ### Installing Application Target and Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Installs the application executable, Flutter ICU data, Flutter library, bundled plugin libraries, and native assets into the installation bundle. ```cmake 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) # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Installing Flutter Library Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs the main Flutter library file into the library directory of the bundle. ```cmake install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installation Bundle Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_kinesis/example/linux/CMakeLists.txt Configures the installation process to create a relocatable bundle. It cleans the build directory, sets installation destinations for the executable, data, and libraries, and copies Flutter assets and AOT libraries. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. 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() # Start with a clean build bundle directory every time. 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) # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. 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 the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Installing Bundled Libraries Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs all bundled libraries provided by plugins into the library directory of the bundle. ```cmake foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) install(FILES "${bundled_library}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endforeach(bundled_library) ``` -------------------------------- ### Setup Amplify Integration Backend Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra/README.md Execute this command for the initial CDK deployment to provision necessary resources. Refer to AWS CDK bootstrapping documentation for more details. ```bash pnpm run setup ``` -------------------------------- ### Installing Application Target and ICU Data Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/example/linux/CMakeLists.txt Installs the application executable to the installation prefix and copies the ICU data file to the data directory within the bundle. ```cmake install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" COMPONENT Runtime) install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Deploy Amplify Integration Backend Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra/README.md Run this command to deploy the CDK stack. Ensure pnpm is installed and the project is bootstrapped if it's the first CDK deployment. ```bash pnpm run deploy ``` -------------------------------- ### Installation Rules for Application Bundle Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/analytics/amplify_analytics_pinpoint/example/linux/CMakeLists.txt Defines rules for installing the application, creating a relocatable bundle in the build directory. It cleans the bundle directory, installs the executable, ICU data, Flutter library, and bundled plugin libraries. ```cmake # === Installation === # By default, "installing" just makes a relocatable bundle in the build # directory. 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() # Start with a clean build bundle directory every time. 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) # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Upgrade List Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/README.md Shows the difference in listing storage items before and after the v0 upgrade. The new API provides pagination details through the `.result` property. ```dart // before final result = await Amplify.Storage.list(); print('Listed items: ${result.items}'); // after final result = await Amplify.Storage.list().result; print('Listed items: ${result.items}'); print('Are there more items can be listed? ${result.hasNextPage}'); print('List nextToken: ${result.nextToken}'); ``` -------------------------------- ### Install Native Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/windows/CMakeLists.txt Installs native assets provided by build.dart from all packages to the library directory. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installation Rules for Runtime Components Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/api/amplify_api/example/windows/CMakeLists.txt Configures the installation process for the application executable, ICU data, Flutter library, bundled plugin libraries, and native assets. Ensures support files are placed correctly for runtime execution. ```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(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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Installation Rules for Runtime Components Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/windows/CMakeLists.txt Configures the installation process for the application executable, ICU data file, Flutter library, bundled plugin libraries, and native assets. It ensures these components are placed correctly for the application to run. ```cmake # === Installation === # Support files are copied into place next to the executable, so that it can # run in place. This is done instead of making a separate bundle (as on Linux) # so that building and running from within Visual Studio will work. set(BUILD_BUNDLE_DIR "$") # Make the "install" step default, as it's required to run. 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(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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. 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 the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Install Bundled Plugin Libraries Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/windows/CMakeLists.txt Installs any bundled native libraries provided by plugins to the library directory. ```cmake if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Project-Level Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/windows/CMakeLists.txt Sets up the minimum CMake version and project name for the Amplify Kinesis example on Windows. ```cmake cmake_minimum_required(VERSION 3.14) project(amplify_firehose_example LANGUAGES CXX) ``` -------------------------------- ### Installing Application Target and Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/api/amplify_api/example/linux/CMakeLists.txt Installs the application executable, ICU data file, Flutter library, bundled libraries, and native assets into the specified bundle directories. ```cmake 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(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Linux Dependencies (Debian/Ubuntu) Source: https://github.com/aws-amplify/amplify-flutter/blob/main/CONTRIBUTING.md Install required 'libsecret' and 'glib' development libraries on Debian-based Linux distributions. ```sh sudo apt update && sudo apt install libsecret-1-dev libglib2.0-dev ``` -------------------------------- ### Install Native Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/linux/CMakeLists.txt Installs native assets provided by build.dart from all packages into the library directory of the bundle. ```cmake # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Install Dependencies and Run Test Runner Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/worker_bee/worker_bee/example/tool/example_web_tester/README.md Installs Python dependencies and executes the main test runner script. Ensure you are in the correct directory. The exit code indicates test success (0) or failure (1). ```bash cd worker-bee/example/tool/example_web_tester pip install -r requirements.txt python3 example_web_tester.py ``` -------------------------------- ### Example Backend Package.json Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra-gen2/readme.md A minimal package.json configuration for a backend within an NPM workspace. Ensure the 'name' field is unique if multiple backends share the same category. ```json { "name": "maininteg", "version": "1.0.0", "main": "index.js" } ``` -------------------------------- ### Installing AOT Library Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Installs the Ahead-Of-Time (AOT) compiled library, but only for 'Profile' and 'Release' build configurations, not for 'Debug'. ```cmake # Install the AOT library on non-Debug builds only. install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Asset Directory Installation Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/api/amplify_api/example/windows/CMakeLists.txt Installs Flutter assets by first removing any existing directory and then copying the new assets from the build directory. This ensures assets are up-to-date. ```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) ``` -------------------------------- ### Project and CMake Version Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Sets the minimum required CMake version and the project name. It also explicitly opts into modern CMake behaviors to avoid warnings. ```cmake cmake_minimum_required(VERSION 3.14) project(example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(VERSION 3.14...3.25) ``` -------------------------------- ### Install Flutter Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Installs the Flutter assets directory to the application's data directory. Removes any existing directory first. ```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) ``` -------------------------------- ### Install Linux Dependencies (RPM-based) Source: https://github.com/aws-amplify/amplify-flutter/blob/main/CONTRIBUTING.md Install required 'libsecret' and 'glib' development libraries on RPM-based Linux distributions like Fedora, CentOS, or RHEL. ```sh sudo dnf update && sudo dnf install libsecret-devel glib2-devel ``` -------------------------------- ### Setting Installation Prefix for Bundled Executable Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/worker_bee/e2e_flutter_test/windows/CMakeLists.txt Configures the installation prefix to be next to the executable for in-place running, especially for Visual Studio builds. ```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() ``` -------------------------------- ### Flutter and System Dependency Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Includes the Flutter managed directory and checks for GTK+ 3.0 using PkgConfig, defining the APPLICATION_ID for the build. ```cmake # Flutter library and tool build rules. set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") ``` -------------------------------- ### Installing Native Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Installs native assets provided by build.dart from all packages into the application bundle's library directory. ```cmake # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Upgrade Download File Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/README.md Illustrates the updated method for downloading files with Amplify Storage. The new approach utilizes an operation object and accesses results via `.result`. ```dart // before final result = await Amplify.Storage.downloadFile( key: 'ExampleKey', local: file, ); print('Downloaded local file path: ${result.file.path}') // after final result = await Amplify.Storage.downloadFile( key: 'ExampleKey', localFile: file, ).result; print('Downloaded file key: ${result.downloadedItem.key}'); print('Downloaded local file path: ${result.localFile.path}'); ``` -------------------------------- ### Dartdoc Template Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/AGENTS.md Use the Dartdoc template system for reusable documentation blocks. ```dart /// {@template amplify_core.amplify_exception} /// Description here. /// {@endtemplate} /// {@macro amplify_core.amplify_exception} ``` -------------------------------- ### Activate and Run Amplify Flutter Repo Tool Source: https://github.com/aws-amplify/amplify-flutter/blob/main/CONTRIBUTING.md Activate the Amplify Flutter Repo Tool (aft) globally and then run the bootstrap command to link local packages and install dependencies. ```sh dart pub global activate -spath packages/aft ``` ```sh aft bootstrap ``` -------------------------------- ### Installing Native Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs native assets provided by packages into the library directory of the bundle. These are copied from a specific build output directory. ```cmake set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Setting Installation Prefix for Bundle Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/api/amplify_api/example/linux/CMakeLists.txt Configures the installation prefix to a bundle directory within the build directory, making the build relocatable. It also ensures a clean bundle directory on each build. ```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 Native Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/auth/amplify_auth_cognito/example/linux/CMakeLists.txt Copies native assets provided by the build.dart script from all packages into the installation bundle's library directory. This ensures that all necessary native resources are included for the application to run correctly. ```cmake # Copy the native assets provided by the build.dart from all packages. set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") install(DIRECTORY "${NATIVE_ASSETS_DIR}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) # Fully re-copy the assets directory on each build to avoid having stale files ``` -------------------------------- ### Localization Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator/example/README.md Configure localization for the Authenticator example app by creating an l10n.yaml file. This file specifies the directory for arb files, the template arb file, and the output localization file. ```yaml arb-dir: lib/l10n template-arb-file: amplify_en.arb output-localization-file: amplify_localizations.dart ``` -------------------------------- ### Upgrade Upload File Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/README.md Compares the old and new API for uploading files using Amplify Storage. The new API returns an operation object with a `.result` property. ```dart // before final result = await Amplify.Storage.uploadFile( local: exampleFile, key: 'ExampleKey', ); print('Uploaded file key: ${result.key}') // after final result = await Amplify.Storage.uploadFile( localFile: exampleFile, key: 'ExampleKey', ).result; print('Uploaded file key: ${result.uploadedItem.key}'); ``` -------------------------------- ### Project-Level CMake Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/storage/amplify_storage_s3/example/windows/CMakeLists.txt Sets the minimum CMake version and project name for the Amplify Storage S3 example on Windows. ```cmake cmake_minimum_required(VERSION 3.14) project(amplify_storage_s3_example LANGUAGES CXX) ``` -------------------------------- ### Generate Amplify Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify_core/test/config/testdata/README.md Run these commands in the `generate` directory to regenerate the `cli_generated.dart` file. Ensure you have Yarn installed. ```sh cd generate yarn && yarn generate ``` -------------------------------- ### Project-Level CMake Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_kinesis/example/windows/CMakeLists.txt Sets the minimum CMake version, project name, and executable binary name for the amplify_kinesis example on Windows. ```cmake cmake_minimum_required(VERSION 3.14) project(amplify_kinesis_example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "amplify_kinesis_example") ``` -------------------------------- ### Minimum CMake Version and Project Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/common/amplify_db_common/linux/CMakeLists.txt Sets the minimum required CMake version and defines the project name and languages. This ensures compatibility with the specified CMake version. ```cmake cmake_minimum_required(VERSION 3.14) # Project-level configuration. set(PROJECT_NAME "amplify_db_common") project(${PROJECT_NAME} LANGUAGES C CXX) ``` -------------------------------- ### Project and Executable Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Sets the minimum CMake version, project name, executable name, and application ID for the Amplify Flutter Linux example. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "amplify_flutter_example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.amazonaws.amplify.amplify_flutter_example") ``` -------------------------------- ### CMake Minimum Version and Ephemeral Directory Setup Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/flutter/CMakeLists.txt Sets the minimum required CMake version and defines a variable for the ephemeral directory, which is used for generated configuration files. ```cmake cmake_minimum_required(VERSION 3.10) set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") ``` -------------------------------- ### Build Authenticator App Widget Source: https://github.com/aws-amplify/amplify-flutter/blob/main/README.md Wrap your MaterialApp with the Authenticator widget to enable authentication flows. This example shows a basic setup with a SignOutButton and a placeholder text. ```dart class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return Authenticator( child: MaterialApp( builder: Authenticator.builder(), home: const Scaffold( body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SignOutButton(), Text('TODO Application'), ], ), ), ), ), ); } } ``` -------------------------------- ### Configure Amplify in main.dart Source: https://github.com/aws-amplify/amplify-flutter/blob/main/README.md Update your main.dart file to configure Amplify with AmplifyAuthCognito and your amplify configuration. This setup handles initial app startup and error handling. ```dart import 'package:amplify_auth_cognito/amplify_auth_cognito.dart'; import 'package:amplify_authenticator/amplify_authenticator.dart'; import 'package:amplify_flutter/amplify_flutter.dart'; import 'package:flutter/material.dart'; import 'amplify_outputs.dart'; Future main() async { try { WidgetsFlutterBinding.ensureInitialized(); await _configureAmplify(); runApp(const MyApp()); } on AmplifyException catch (e) { runApp(Text("Error configuring Amplify: ${e.message}")); } } Future _configureAmplify() async { try { await Amplify.addPlugin(AmplifyAuthCognito()); await Amplify.configure(amplifyConfig); safePrint('Successfully configured'); } on Exception catch (e) { safePrint('Error configuring Amplify: $e'); } } ``` -------------------------------- ### Installing Flutter Assets Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/windows/CMakeLists.txt Ensures the Flutter assets directory is completely re-copied on each build to prevent stale files. It first removes the old directory and then copies the new one. ```cmake # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. 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) ``` -------------------------------- ### Deploy Gen 2 Backends Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra-gen2/readme.md Run this command to create and deploy Gen 2 backends. It automates the Amplify sandbox process, combines backend outputs, distributes configuration files, and uploads them to S3 buckets. ```bash dart run tool/deploy_gen2.dart ``` -------------------------------- ### Generate Amplify Sandbox Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify_core/test/config/amplify_outputs_mapping/app/README.md Run this command to initiate the Amplify sandbox environment. ```bash npx ampx sandbox ``` -------------------------------- ### Create a New Amplify Backend Source: https://github.com/aws-amplify/amplify-flutter/blob/main/infra-gen2/readme.md Command to create a new Amplify backend project. This should be run within the new backend directory. ```bash npm create amplify@latest -y ``` -------------------------------- ### Activate and Run Local aft CLI Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/aft/README.md Activate the local aft package and run the help command to see available options. Ensure the Dart pub cache is in your PATH. ```sh $ dart pub global activate -spath packages/aft $ aft --help ``` -------------------------------- ### Install AOT Library (Non-Debug) Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/linux/CMakeLists.txt Conditionally installs the Ahead-Of-Time (AOT) compiled library on non-debug builds. ```cmake # Install the AOT library on non-Debug builds only. if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() ``` -------------------------------- ### Applying Standard Settings and Properties Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/common/amplify_db_common/windows/CMakeLists.txt Applies standard build settings and configures visibility for the plugin library. ```cmake apply_standard_settings(${PLUGIN_NAME}) set_target_properties(${PLUGIN_NAME} PROPERTIES CXX_VISIBILITY_PRESET hidden) target_compile_definitions(${PLUGIN_NAME} PRIVATE FLUTTER_PLUGIN_IMPL) target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin) ``` -------------------------------- ### Installing ICU Data File Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs the ICU data file, which is necessary for internationalization, into the data directory of the bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Project and Build Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_kinesis/example/linux/CMakeLists.txt Sets up the minimum CMake version, project name, executable name, and application ID. It also defines build type and applies standard compilation settings. ```cmake cmake_minimum_required(VERSION 3.13) project(runner LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "amplify_kinesis_example") # The unique GTK application identifier for this application. See: # https://wiki.gnome.org/HowDoI/ChooseApplicationID set(APPLICATION_ID "com.amazonaws.amplify.amplify_kinesis_example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(SET CMP0063 NEW) # Load bundled libraries from the lib/ directory relative to the binary. set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") # Root filesystem for cross-building. if(FLUTTER_TARGET_PLATFORM_SYSROOT) set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() # Define build configuration options. 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() # Compilation settings that should be applied to most targets. # # Be cautious about adding new options here, as plugins use this function by # default. In most cases, you should add new options to specific targets instead # of modifying this function. 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() # Flutter library and tool build rules. set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") add_subdirectory(${FLUTTER_MANAGED_DIR}) # System-level dependencies. find_package(PkgConfig REQUIRED) pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) # Application build; see runner/CMakeLists.txt. add_subdirectory("runner") # Run the Flutter tool portions of the build. This must not be removed. add_dependencies(${BINARY_NAME} flutter_assemble) # Only the install-generated bundle's copy of the executable will launch # correctly, since the resources must in the right relative locations. To avoid # people trying to run the unbundled copy, put it in a subdirectory instead of # the default top-level location. set_target_properties(${BINARY_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" ) # Generated plugin build rules, which manage building the plugins and adding # them to the application. include(flutter/generated_plugins.cmake) ``` -------------------------------- ### Project and Build Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/analytics/amplify_analytics_pinpoint/example/windows/CMakeLists.txt Sets up the CMake minimum version, project name, and executable name. It also configures build types like Debug, Profile, and Release, and handles multi-configuration generators. ```cmake cmake_minimum_required(VERSION 3.14) project(amplify_analytics_pinpoint_example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "amplify_analytics_pinpoint_example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(SET CMP0063 NEW) # Define build configuration option. 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() # Define settings for the Profile build mode. 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}") # Use Unicode for all projects. add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Initialize AWSSigV4Signer Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/aws_signature_v4/README.md Create an instance of AWSSigV4Signer. By default, it uses credentials from the environment. ```dart import 'package:aws_signature_v4/aws_signature_v4.dart'; const signer = AWSSigV4Signer(); ``` -------------------------------- ### Cleaning Build Bundle Directory Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/authenticator/amplify_authenticator_test/example/linux/CMakeLists.txt Installs a code that removes the build bundle directory before installation, ensuring a clean state for the new bundle. ```cmake install(CODE " file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") " COMPONENT Runtime) ``` -------------------------------- ### Install Flutter ICU Data and Library Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/linux/CMakeLists.txt Installs the Flutter ICU data file and the main Flutter library to their respective destinations within the bundle. ```cmake install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) ``` -------------------------------- ### Provision Resources for Integration Tests Source: https://github.com/aws-amplify/amplify-flutter/blob/main/CONTRIBUTING.md Script to create all necessary backend environments for integration tests. This script utilizes AWS CDK and Amplify CLI and can be re-run as needed. ```bash $ tool/provision_integration_test_resources.sh ``` -------------------------------- ### Project and Build Configuration Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/windows/CMakeLists.txt Sets up the minimum CMake version, project name, and executable name. It also configures build types like Debug, Profile, and Release, and defines settings for the Profile build mode. ```cmake cmake_minimum_required(VERSION 3.14) project(amplify_flutter_example LANGUAGES CXX) # The name of the executable created for the application. Change this to change # the on-disk name of your application. set(BINARY_NAME "amplify_flutter_example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. cmake_policy(SET CMP0063 NEW) # Define build configuration option. 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() # Define settings for the Profile build mode. 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}") # Use Unicode for all projects. add_definitions(-DUNICODE -D_UNICODE) ``` -------------------------------- ### Mixin Composition Example Source: https://github.com/aws-amplify/amplify-flutter/blob/main/AGENTS.md Compose multiple mixins to add functionality like equality, serialization, and debugging to a class. ```dart class AmplifyOutputs with AWSEquatable, AWSSerializable, AWSDebuggable { ... } ``` -------------------------------- ### Application Build Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/kinesis/amplify_firehose/example/windows/CMakeLists.txt Includes the runner subdirectory, which contains the main application build rules. ```cmake add_subdirectory("runner") ``` -------------------------------- ### Fetch and Configure SQLite3 Library Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/common/amplify_db_common/windows/CMakeLists.txt Fetches the SQLite3 library from a URL and declares it for use. Handles different CMake versions for download extraction. ```cmake if (NOT USE_CUSTOM_SQLITE3) # Include and define sqlite3 if not already defined if (NOT TARGET sqlite3) include(FetchContent) if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") # cmake 3.24.0 added the `DOWNLOAD_EXTRACT_TIMESTAMP` and prints an ugly warning when # the default is used, so override it to the recommended behavior. # We can't really ask users to use a cmake that recent, so there's this if here. FetchContent_Declare( sqlite3 URL https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz DOWNLOAD_EXTRACT_TIMESTAMP NEW ) else() FetchContent_Declare( sqlite3 URL https://sqlite.org/2023/sqlite-autoconf-3430000.tar.gz ) endif() FetchContent_MakeAvailable(sqlite3) ``` -------------------------------- ### Export Flutter Library and ICU Data Source: https://github.com/aws-amplify/amplify-flutter/blob/main/packages/amplify/amplify_flutter/example/windows/flutter/CMakeLists.txt Publishes the Flutter library path and ICU data file to the parent scope for use in the install step. ```cmake set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) ``` -------------------------------- ### Add Amplify Flutter Dependencies Source: https://github.com/aws-amplify/amplify-flutter/blob/main/README.md Add these dependencies to your pubspec.yaml file to use the Amplify Authenticator. Ensure you run `flutter pub get` after updating. ```yaml dependencies: amplify_auth_cognito: ^2.0.0 amplify_authenticator: ^2.0.0 amplify_flutter: ^2.0.0 flutter: sdk: flutter ```