### Run Flutter App Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_location_flutter/example/EXAMPLE.md Executes the Flutter application in the current directory. Assumes the project has been set up and dependencies are installed. ```sh flutter run ``` -------------------------------- ### Configure Installation Rules for Runtime Components in CMake Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contacts_flutter/example/windows/CMakeLists.txt This section defines the installation rules for the CMake project, ensuring that runtime components, libraries, and assets are correctly placed next to the executable. It configures the installation prefix and specifies which files and directories to install for the Runtime component. ```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() # 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) ``` -------------------------------- ### Activate and Create App with at_app (Flutter/Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contact/README.md These commands demonstrate how to activate the at_app global tool and use it to create a new Flutter application based on a sample package. This is a quick way to get a working example of an atPlatform application. ```sh $ flutter pub global activate at_app $ at_app create --sample= $ cd $ flutter run ``` -------------------------------- ### Create a New Flutter App with at_app Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/example/example.md This command-line snippet shows how to activate the at_app tool globally and then use it to create a new Flutter application, potentially forking a sample from a package ID. It's a prerequisite for running the at_backupkey_flutter example. ```sh flutter pub global activate at_app at_app create --sample= cd flutter run ``` -------------------------------- ### CMake Project Setup and Configuration Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/example/linux/CMakeLists.txt Initializes the CMake project, sets the binary name and application ID, and configures build policies and installation paths. It also handles cross-compilation by setting the sysroot and find root path if a Flutter target platform sysroot is provided. ```cmake cmake_minimum_required(VERSION 3.10) project(runner LANGUAGES CXX) set(BINARY_NAME "at_backupkey_flutter_example") set(APPLICATION_ID "com.atsign.at_backupkey_flutter") cmake_policy(SET CMP0063 NEW) 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() # Configure build 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() ``` -------------------------------- ### Install Runtime Components for Flutter Application with CMake Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/example/windows/CMakeLists.txt This CMake snippet defines the installation rules for a Flutter application. It ensures that the main executable, runtime libraries, ICU data, and assets are correctly copied to the installation prefix. It also handles the installation of AOT libraries for non-Debug builds and manages the assets directory to prevent stale files. ```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() # 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) ``` -------------------------------- ### Clone at_widgets GitHub Repository Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/README.md This command clones the at_widgets repository from GitHub, which contains example code demonstrating the usage of the at_backupkey_flutter package. This is one of the methods to get started with the package. ```sh $ git clone https://github.com/atsign-foundation/at_widgets ``` -------------------------------- ### Add at_onboarding_cli Dependency Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This snippet shows how to add the `at_onboarding_cli` package as a dependency in your `pubspec.yaml` file. After adding the dependency, run `dart pub get` to fetch the package. ```yaml dependencies: at_onboarding_cli: ^1.3.0 ``` -------------------------------- ### CustomAppBar Widget Example (Flutter) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_common_flutter/example/example.md Shows how to implement the CustomAppBar widget from the at_common_flutter package. This example configures the app bar with a title, back button visibility, and a trailing icon with a press handler. ```dart return Scaffold( appBar: CustomAppBar( showBackButton: false, showTitle: true, titleText: widget.title, onTrailingIconPressed: () { print('Trailing icon of appbar pressed'); }, showTrailingIcon: true, trailingIcon: Center( child: Icon( Icons.add, color: Theme.of(context).brightness == Brightness.light ? Colors.black : Colors.white, ), ), ), ); ``` -------------------------------- ### Dart Sample Usage Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/tests/at_functional_test/README.md A basic Dart code snippet demonstrating a sample usage within the At Client SDK. This example shows a simple constant declaration. ```dart const like = 'sample'; ``` -------------------------------- ### Installation Rules for Application Bundle Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/example/linux/CMakeLists.txt Configures the installation process to create a relocatable application bundle. It cleans the build bundle directory, installs the main executable, ICU data, Flutter library, bundled plugin libraries, and assets. It also conditionally installs the AOT library for non-Debug builds. ```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) if(PLUGIN_BUNDLED_LIBRARIES) install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" COMPONENT Runtime) endif() # 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() ``` -------------------------------- ### Get Key Value (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_lookup/example/README.md Retrieves the value associated with a specific key from the secondary server. Authentication is required for accessing the key. The `auth` parameter should be set to true. ```dart // Builds lookup key builder var lookupVerbBuilder = LookupVerbBuilder() ..atKey = 'phone' ..sharedBy = '@bob' ..auth = true; // Sends lookup command to secondary server var lookupResult = atLookupImpl.executeVerb(lookupVerbBuilder); ``` -------------------------------- ### Basic Usage of at_client_sdk in Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/tests/at_end2end_test/README.md Demonstrates the fundamental setup and initialization of the at_client_sdk within a Dart application. It shows the necessary import statement and a basic main function structure. ```dart import 'package:at_end2end_test/at_end2end_test.dart'; main() { var awesome = new Awesome(); } ``` -------------------------------- ### SizeConfig Service Initialization (Flutter) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_common_flutter/example/example.md Shows how to initialize the SizeConfig service from the at_common_flutter package. This service is essential for adjusting widget heights based on screen size and must be initialized with the build context before use. ```dart import 'package:at_common_flutter/at_common_flutter.dart' as CommonWidgets; CommonWidgets.SizeConfig().init(context); ``` -------------------------------- ### Create a New Flutter App with at_app CLI Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contacts_group_flutter/example/example.md Provides instructions on how to create a new Flutter application using the 'at_app' command-line interface, specifically for using a package ID as a sample. ```sh flutter pub global activate at_app at_app create --sample= cd flutter run ``` -------------------------------- ### Initialize at_sync_ui_flutter Service Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_sync_ui_flutter/example/README.md This Dart code snippet demonstrates how to initialize the `AtSyncUIService` within a Flutter application. It requires the navigation key, and optional success and error callbacks to handle the synchronization process. ```dart AtSyncUIService().init( appNavigator: NavService.navKey, onSuccessCallback: _onSuccessCallback, onErrorCallback: _onErrorCallback, ); ``` -------------------------------- ### Initial atSign Status (Not Found) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_server_status/README.md This example shows the expected status values when an atSign has been provisioned but an atServer has not yet been deployed or is unavailable. It includes rootStatus, serverStatus, and the overall status. ```dart AtStatus.rootStatus = RootStatus.notFound AtStatus.serverStatus = ServerStatus.unavailable AtStatus.status() = AtSignStatus.notFound AtStatus.httpStatus() = 404 ``` -------------------------------- ### AtSyncDialog Usage in Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_sync_ui_flutter/README.md Provides an example of using AtSyncDialog for displaying synchronization-related messages. It shows how to instantiate, show, update, and close the dialog, taking a 'context', 'value', and 'message' as parameters. ```dart final dialog = material.AtSyncDialog(context: context); dialog.show(message: 'Downloading ...'); dialog.update(value: _value, message: 'Downloading ...'); dialog.close(); ``` -------------------------------- ### Initialize Contacts Service in Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contacts_flutter/README.md Demonstrates the necessary setup for the at_contacts_flutter package in a Dart project. It shows how to initialize the contacts service with the root domain. This is a prerequisite for using the package's contact management features. ```dart initializeContactsService(rootDomain: AtEnv.rootDomain); ``` -------------------------------- ### iOS Podfile Configuration for Permissions Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/README.md Updates the Podfile for iOS projects to configure build settings and preprocessor definitions for various permission groups. This is part of the setup for the at_backupkey_flutter package on iOS. ```ruby post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', ## dart: PermissionGroup.calendar 'PERMISSION_EVENTS=0', ## dart: PermissionGroup.reminders 'PERMISSION_REMINDERS=0', ## dart: PermissionGroup.contacts 'PERMISSION_CONTACTS=0', ## dart: PermissionGroup.microphone 'PERMISSION_MICROPHONE=0', ## dart: PermissionGroup.speech 'PERMISSION_SPEECH_RECOGNIZER=0', ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] 'PERMISSION_LOCATION=0', ## dart: PermissionGroup.notification 'PERMISSION_NOTIFICATIONS=0', ## dart: PermissionGroup.sensors 'PERMISSION_SENSORS=0' ] end end end ``` -------------------------------- ### Initialize SizeConfig Service in Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contacts_flutter/README.md Shows how to initialize the SizeConfig service, which is required if you are using UI widgets from the at_contacts_flutter package. This setup ensures that UI elements are correctly sized and displayed within the Flutter application context. ```dart SizeConfig().init(context); ``` -------------------------------- ### Dart: Command-Line Onboarding and Authentication with at_onboarding_cli Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt The at_onboarding_cli package provides command-line tools for headless applications to onboard and authenticate atSigns. It allows configuration of onboarding preferences such as root domain, storage paths, and namespace. It supports both authenticating existing atSigns using a .atKeys file and onboarding new atSigns with a CRAM secret. The package returns an authenticated `AtClient` or `AtLookUp` instance upon successful authentication or onboarding. ```dart import 'package:at_onboarding_cli/at_onboarding_cli.dart'; // Configure onboarding preferences AtOnboardingPreference preference = AtOnboardingPreference() ..rootDomain = 'root.atsign.org' ..hiveStoragePath = 'storage/hive' ..namespace = 'myapp' ..commitLogPath = 'storage/commitLog' ..atKeysFilePath = 'storage/@alice_key.atKeys'; // Create onboarding service AtOnboardingService onboardingService = AtOnboardingServiceImpl( '@alice', preference, ); // Authenticate (for existing atSigns with .atKeys file) bool authenticated = await onboardingService.authenticate(); if (authenticated) { // Get authenticated AtClient AtClient? atClient = await onboardingService.atClient; // Get authenticated AtLookUp for low-level operations AtLookUp? atLookUp = onboardingService.atLookUp; // Use atClient for operations AtKey key = AtKey()..key = 'greeting'..namespace = 'myapp'; await atClient?.put(key, 'Hello from CLI!'); } // Or onboard a new atSign (first-time activation) AtOnboardingPreference onboardPreference = AtOnboardingPreference() ..rootDomain = 'root.atsign.org' ..cramSecret = 'cramSecretFromQRCode' ..hiveStoragePath = 'storage/hive' ..commitLogPath = 'storage/commitLog' ..atKeysFilePath = 'storage/@alice_key.atKeys'; AtOnboardingService newOnboarding = AtOnboardingServiceImpl('@alice', onboardPreference); bool onboarded = await newOnboarding.onboard(); ``` -------------------------------- ### Construct AtKeys using Fluent Builders Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt Demonstrates the use of fluent builders to construct various types of AtKeys, including self, public, and shared keys. It also shows how to build a complex AtKey with metadata like Time-To-Live (TTL), Time-To-Block (TTB), and cache duration. ```dart // Self key (private, only accessible by owner) AtKey selfKey = AtKey.self('phone', namespace: 'myapp').build(); // Public key (accessible by anyone) AtKey publicKey = AtKey.public('location', namespace: 'myapp').build(); // Shared key (encrypted for specific recipient) AtKey sharedKey = (AtKey.shared('phone', namespace: 'myapp') ..sharedWith('@bob')) .build(); // Key with full metadata AtKey complexKey = AtKey() ..key = 'document' ..namespace = 'myapp' ..sharedWith = '@bob' ..metadata = (Metadata() ..ttl = 86400000 // 24 hours ..ttb = 3600000 // Available after 1 hour ..ttr = 600000 // Recipient caches for 10 minutes ..ccd = true // Cascade delete ..isPublic = false ..isEncrypted = true); ``` -------------------------------- ### Configure AtOnboardingPreference Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This Dart code illustrates how to set up `AtOnboardingPreference` to configure the `AtOnboardingService`. It includes settings for root domain, storage paths, namespace, and authentication credentials like cram secret or private key. ```dart AtOnboardingPreference atOnboardingPreference = AtOnboardingPreference() ..rootDomain = 'root.atsign.org' ..qrCodePath = 'storage/qr_code.png' ..hiveStoragePath = 'storage/hive' ..namespace = 'example' ..downloadPath = 'storage/files' ..isLocalStoreRequired = true ..commitLogPath = 'storage/commitLog' ..cramSecret = '' ..privateKey = '' ..atKeysFilePath = 'storage/alice_key.atKeys'; ``` -------------------------------- ### Register Free atSign using CLI (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md Registers a new free atSign by fetching it and associating it with a provided email address. This command-line tool handles the fetching and registration process, optionally using a verification code sent to the email. It automatically calls activate_cli upon successful registration. ```dart dart pub global activate at_onboarding_cli at_register -e your_email ``` ```dart dart run bin/register.dart -e email@email.com ``` -------------------------------- ### Get and Set App Theme in Flutter Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_theme_flutter/example/README.md These Dart code snippets show how to retrieve the currently saved theme data and how to set a custom application theme using the at_theme_flutter package. The `getThemeData()` function fetches the saved theme, while `setAppTheme()` applies a new custom theme. These are essential for managing the visual appearance of your atPlatform Flutter application. ```dart AppTheme? appTheme = await getThemeData(); ``` ```dart var appTheme = AppTheme.from(); var result = await setAppTheme(appTheme); ``` -------------------------------- ### CustomButton Widget Example (Flutter) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_common_flutter/example/example.md Illustrates the usage of the CustomButton widget from the at_common_flutter package. This example defines the button's dimensions, text, color scheme, and an onPressed callback function. ```dart CustomButton( height: 50.0, width: 200.0, buttonText: 'Add', onPressed: () { print('Custom button pressed'); }, buttonColor: Theme.of(context).brightness == Brightness.light ? Colors.black : Colors.white, fontColor: Theme.of(context).brightness == Brightness.light ? Colors.white : Colors.black, ), ``` -------------------------------- ### Initialize atLookup Instance (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_lookup/example/README.md Initializes an instance of AtLookupImpl to connect to the secondary server. Requires the atsign, secondary server hostname, port, and optionally private key or cram secret for authentication. ```dart var atLookupImpl = AtLookupImpl( '@alice', 'root.atsign.com', 64, privateKey: 'privateKey', cramSecret: 'cramSecret', ); ``` -------------------------------- ### Onboard atSign using at_onboarding_cli Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This Dart code demonstrates onboarding (activating) an atSign using `AtOnboardingServiceImpl`. It can use a cram secret or a verification code sent to the registered email. It returns authenticated `AtClient` and `AtLookup` instances upon successful onboarding. ```dart AtOnboardingService atOnboardingService = AtOnboardingServiceImpl('@alice', atOnboardingPreference); atOnboardingService.onboard(); > Successfully sent verification code to your registered e-mail > [Action Required] Enter your verification code: AtClient? atClient = await atOnboardingService.atClient(); AtLookup? atLookup = atOnboardingService.atLookUp(); ``` -------------------------------- ### Activate atSign using CLI (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md Activates an atSign using the command-line interface. Requires the atSign name and a CRAM secret or will prompt for a verification code. The .atKeysFile is generated in ~/.atsign/keys. ```dart dart run bin/activate_cli.dart -a your_atsign -c your_cram_secret (or) dart run bin/activate_cli.dart -a your_atsign (to activate using verification code) ``` -------------------------------- ### Clear Paired Atsigns in Flutter Example Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_location_flutter/example/EXAMPLE.md Provides a button in the Flutter example app to clear all paired atsigns. This action removes stored cryptographic keys and resets the pairing state. ```dart // Button action to clear paired atsigns ``` -------------------------------- ### Activate atSign using Verification Code (CLI) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This command-line usage demonstrates activating an atSign using a verification code sent to the registered email. It requires the `at_onboarding_cli` package to be activated globally. ```sh dart pub global activate at_onboarding_cli at_activate -a your_atsign > Successfully sent verification code to your registered e-mail > [Action Required] Enter your verification code: ``` -------------------------------- ### CustomInputField Widget Example (Flutter) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_common_flutter/example/example.md Demonstrates how to use the CustomInputField widget from the at_common_flutter package. This example sets an initial value, specifies an icon, and provides a callback function to capture the input field's value. ```dart CustomInputField( icon: Icons.emoji_emotions_outlined, width: 200.0, initialValue: "initial value", value: (String val) { print('Current value of input field: $val'); }, ), ``` -------------------------------- ### Dart: Onboarding and Authenticating atSigns with at_auth Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt The at_auth package facilitates the initial onboarding (activation) and subsequent authentication of atSigns. It supports onboarding using a CRAM secret obtained during QR code scanning and authentication using a local .atKeys file. The package provides `AtOnboardingRequest` and `AtAuthRequest` for configuring these processes and returns `AtOnboardingResponse` or `AtAuthResponse` indicating success or failure. ```dart import 'package:at_auth/at_auth.dart'; // Create AtAuth instance final atAuth = AtAuth.create(); // Onboard with CRAM secret (first-time activation) final atOnboardingRequest = AtOnboardingRequest('@alice') ..rootDomain = AtRootDomain('root.atsign.org', 64) ..appName = 'myapp' ..deviceName = 'iphone'; final atOnboardingResponse = await atAuth.onboard( atOnboardingRequest, 'cramSecretFromQRCode', ); if (atOnboardingResponse.isSuccessful) { print('Onboarding successful!'); print('Keys file: ${atOnboardingResponse.atAuthKeys}'); } ``` ```dart import 'package:at_auth/at_auth.dart'; final atAuth = AtAuth.create(); // Authenticate using .atKeys file final atAuthRequest = AtAuthRequest('@alice') ..rootDomain = AtRootDomain('root.atsign.org', 64) ..atKeysFilePath = '/path/to/@alice_key.atKeys'; final atAuthResponse = await atAuth.authenticate(atAuthRequest); if (atAuthResponse.isSuccessful) { print('Authentication successful!'); // Use atAuthResponse.atChops for crypto operations } ``` -------------------------------- ### CMake Installation Rules for Application and Assets Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_client_flutter/example/windows/CMakeLists.txt Configures the installation process for the application executable, Flutter ICU data, libraries, and native assets. It ensures files are copied to the correct destinations relative to the installation prefix, supporting in-place 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) 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(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" CONFIGURATIONS Profile;Release COMPONENT Runtime) ``` -------------------------------- ### Authenticate atSign using at_onboarding_cli Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This Dart code shows the process of authenticating an atSign using `AtOnboardingServiceImpl`. It requires an `AtOnboardingPreference` instance and provides access to authenticated `AtClient` and `AtLookup` instances for further operations. ```dart AtOnboardingService atOnboardingService = AtOnboardingServiceImpl('@alice', atOnboardingPreference); atOnboardingService.authenticate(); AtClient? atClient = await atOnboardingService.atClient; AtLookup? atLookup = atOnboardingService.atLookUp; ``` -------------------------------- ### Onboard an atsign using Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_auth/README.md Demonstrates how to onboard an atsign using the AtAuth SDK in Dart. This involves creating an AtAuth instance, defining onboarding requests with root domain, app name, and device name, and then calling the onboard method with a cram secret. ```dart final atAuth = AtAuth.create(); final atOnboardingRequest = AtOnboardingRequest('@alice') ..rootDomain = AtRootDomain('vip.ve.atsign.zone', 64) ..appName = 'wavi' ..deviceName = 'iphone'; final atOnboardingResponse = await atAuth.onboard(atOnboardingRequest, ); ``` -------------------------------- ### Configure Installation Bundle in CMake Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_client_flutter/example/linux/CMakeLists.txt Sets up the installation process for the Flutter application, defining the bundle directory and ensuring a clean build directory for each installation. It specifies destinations for the executable, ICU data, Flutter library, bundled libraries, and native assets. ```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() ``` -------------------------------- ### Get Data with AtClient Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_client/README.md Retrieves data associated with a specific AtKey. The `get()` method fetches the value from the atPlatform using the provided AtKey object and returns it as an AtValue. ```dart AtKey atKey = AtKey() ..key='phone' ..namespace = '.myApp'; AtValue value = await atClientInstance.get(atKey); print(value.value); // +00 123-456-7890 ``` -------------------------------- ### Get Contact Details - Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contact/README.md Illustrates how to retrieve a contact's details using the `get()` function, which requires the atSign of the contact to be fetched. The fetched contact data can then be used in the UI. ```dart AtContact? userContact; Future _getContactDetails(String atSign) async { // Optionally pass the atKeys. AtContact? _contact = await _atContact.get(atSign); if(_contact == null){ print("Failed to fetch contact data."); } else { // Assign the fetched contact value to userContact. // And use the value accordingly in the UI. userContact = _contact; } } ``` -------------------------------- ### Clone at_widgets Repository from GitHub Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_chat_flutter/README.md Instructions to clone the at_widgets repository from GitHub, which contains the source code for at_chat_flutter and its example applications. This allows developers to access the full source code and examples. ```sh git clone https://github.com/atsign-foundation/at_widgets.git ``` -------------------------------- ### Import at_onboarding_cli Library Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This code demonstrates how to import the `at_onboarding_cli` library into your Dart application. This import statement is necessary to use the classes and functions provided by the library. ```dart import 'package:at_onboarding_cli/at_onboarding_cli.dart'; ``` -------------------------------- ### Activate atSign using Cram Secret (CLI) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_onboarding_cli/README.md This command-line usage demonstrates activating an atSign using a cram secret. It requires the `at_onboarding_cli` package to be activated globally. ```sh dart pub global activate at_onboarding_cli at_activate -a your_atsign -c your_cram_secret ``` -------------------------------- ### Track Location in Flutter Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_location_flutter/example/EXAMPLE.md Navigates to the AtLocationFlutterPlugin widget to display the location of a specified atsign. Requires passing necessary parameters to the widget. ```dart AtLocationFlutterPlugin(parameters...); ``` -------------------------------- ### Configure AtClient Preferences Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_client/README.md Sets up AtClientPreferences with essential configurations like root domain, namespace, storage paths, and local store requirement. These preferences are crucial for initializing the AtClient instance. ```dart Directory appSupportDir = await getApplicationSupportDirectory(); AtClientPreference preferences = AtClientPreference() ..rootDomain = 'root.atsign.org' ..namespace = '.my_namespace' ..hiveStoragePath = appSupportDir.path ..commitLogPath = appSupportDirdir.path ..isLocalStoreRequired = true; ``` -------------------------------- ### Android Activity Export Configuration Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_backupkey_flutter/README.md Configuration for the AndroidManifest.xml file to set the activity to be exported. This is a required setup step for the at_backupkey_flutter package on Android. ```xml ``` ``` -------------------------------- ### Apply Standard Build Settings (CMake) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_client_flutter/example/windows/runner/CMakeLists.txt This command applies a predefined set of standard build settings to the application target. It simplifies configuration by encapsulating common build options. This can be omitted if custom build settings are required. ```cmake apply_standard_settings(${BINARY_NAME}) ``` -------------------------------- ### Initialize AtClient from Command Line Arguments (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_cli_commons/README.md Demonstrates the simplest way to obtain an AtClient instance by parsing command-line arguments using the CLIBase class. This method handles boilerplate setup, including argument parsing and authentication. ```dart AtClient atClient = (await CLIBase.fromCommandLineArgs(args)).atClient; ``` -------------------------------- ### Show Multiple Location Points in Flutter Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_location_flutter/example/EXAMPLE.md Displays static markers on the map at specified latitude and longitude coordinates. Uses the showLocation function with predefined geo-coordinates. ```dart showLocation(LatLng(30, 45), LatLng(40, 45)); ``` -------------------------------- ### Initialize at_notify_flutter Service Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_notify_flutter/example/EXAMPLE.md Initializes the notification service for the at_notify_flutter package. This function requires the AtClientManager, the active atsign, client preferences, and optionally the root domain. ```dart initializeNotifyService( atClientManager, activeAtSign!, atClientPreference, rootDomain: AtEnv.rootDomain, ); ``` -------------------------------- ### Initialize and Manage AtClient with AtClientManager (Dart/Flutter) Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt Initializes and manages AtClient instances, sync services, and notification services for a given atSign. Requires setting up preferences like root domain, namespace, and storage paths. Returns an instance of AtClientManager. ```dart import 'package:at_client/at_client.dart'; import 'package:path_provider/path_provider.dart'; // Set up preferences for the atClient Directory appSupportDir = await getApplicationSupportDirectory(); AtClientPreference preferences = AtClientPreference() ..rootDomain = 'root.atsign.org' ..namespace = 'myapp' ..hiveStoragePath = appSupportDir.path ..commitLogPath = appSupportDir.path ..isLocalStoreRequired = true; // Initialize AtClientManager with an atSign AtClientManager atClientManager = await AtClientManager.getInstance() .setCurrentAtSign('@alice', 'myapp', preferences); // Access the AtClient instance AtClient atClient = atClientManager.atClient; // Access sync and notification services SyncService syncService = atClient.syncService; NotificationService notificationService = atClient.notificationService; ``` -------------------------------- ### Scan Keys (Dart) Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_lookup/example/README.md Retrieves a list of all keys associated with the current atsign from the secondary server. This operation does not require specific key details. ```dart // Builds scan verb builder var scanVerbBuilder = ScanVerbBuilder(); var scanResult = atLookupImpl.executeVerb(scanVerbBuilder); ``` -------------------------------- ### Initialize and Use at_location_flutter Location Sharing Widget Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt Shows how to initialize the location service, share and request locations, and display a map with tracked atSigns using the at_location_flutter package. Requires API keys for map services and a navigator key for navigation. ```dart import 'package:at_location_flutter/at_location_flutter.dart'; // Initialize location service (requires navigator key for navigation) GlobalKey navKey = GlobalKey(); await initializeLocationService( navKey, mapKey: 'your_maptiler_api_key', apiKey: 'your_here_api_key', showDialogBox: true, ); // Share location with another atSign for 30 minutes sendShareLocationNotification('@bob', 30); // Request location from another atSign sendRequestLocationNotification('@bob'); // Display map with tracked atSigns Widget locationMap = AtLocationFlutterPlugin( ['@bob', '@charlie', '@dave'], ); // Navigate to default map screen Navigator.push( context, MaterialPageRoute( builder: (context) => MapScreen( currentAtSign: '@alice', userListenerKeyword: locationNotificationModel, ), ), ); // Navigate to home screen with all location features Navigator.push( context, MaterialPageRoute( builder: (context) => HomeScreen(), ), ); ``` -------------------------------- ### AtSyncSnackBar Usage in Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_sync_ui_flutter/README.md Illustrates the usage of AtSyncSnackBar for displaying synchronization notifications. The example shows instantiation, showing, updating, and dismissing the snackbar, utilizing 'context', 'value', and 'message'. ```dart final snackBar = material.AtSyncSnackBar(context: context); snackBar.show(message: 'Downloading ...'); snackBar.update(value: _value, message: 'Downloading ...'); snackBar.dismiss(); ``` -------------------------------- ### List Favorite Contacts - Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contact/README.md Demonstrates how to retrieve a list of only the favorite contacts by calling the `listFavoriteContacts()` function. The result can be used to update the UI, for example, by assigning it to a state variable. ```dart List favContactsList = []; Future _listFavoriteContacts() async { List _favContactsList = await _atContact.listFavoriteContacts(); if(_favContactsList.isEmpty){ print("No favorite contacts found"); } else { favContactsList = _favContactsList; } } ``` -------------------------------- ### List All Contacts - Dart Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_contact/README.md Provides an example of how to list all contacts associated with the user by calling the `listContacts()` function. The returned list can be used to populate a UI element like a ListView. ```dart /// In Contacts list screen, call the `listContacts()`. Future _listAllContacts() async { List contactsList = await _atContact.listContacts(); // Use this contactsList in the UI part and render the data as you wish. // Or use FutureBuilder and ListView to show the contact data as a list. } ``` -------------------------------- ### Access AtNotifications Stream in Flutter Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_location_flutter/example/EXAMPLE.md Provides access to the stream of at_notifications, allowing developers to listen for incoming and outgoing share/request location notifications. This is useful for displaying notification lists. ```dart KeyStreamService().atNotificationsStream ``` -------------------------------- ### Initialize at_chat_flutter Service Source: https://github.com/atsign-foundation/at_client_sdk/blob/trunk/packages/at_chat_flutter/README.md Demonstrates the Dart code required to initialize the at_chat_flutter service. It shows how to create an AtClientService instance using preferences and then use it to set up the chat service, specifying the root domain. ```dart initializeChatService(atClientManager, activeAtSign!, rootDomain: AtEnv.rootDomain); ``` -------------------------------- ### Initialize and Use at_chat_flutter Chat Widget Source: https://context7.com/atsign-foundation/at_client_sdk/llms.txt Demonstrates how to initialize the chat service, set a chat partner, and display a chat interface using the at_chat_flutter package. This widget facilitates end-to-end encrypted peer-to-peer chat within Flutter applications. ```dart import 'package:at_chat_flutter/at_chat_flutter.dart'; // Initialize chat service AtClientManager atClientManager = AtClientManager.getInstance(); initializeChatService( atClientManager, '@alice', // Current atSign rootDomain: 'root.atsign.org', ); // Set the chat partner setChatWithAtSign('@bob'); // Display chat as a screen class ChatPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Chat with @bob')), body: ChatScreen( height: MediaQuery.of(context).size.height, incomingMessageColor: Colors.blue[100], outgoingMessageColor: Colors.green[100], isScreen: true, ), ); } } // Display chat as bottom sheet void showChatBottomSheet(BuildContext context, GlobalKey scaffoldKey) { scaffoldKey.currentState?.showBottomSheet( (context) => ChatScreen( height: 400, ), ); } ```