### Initialize Clarity SDK and Wrap Flutter Application Source: https://pub.dev/documentation/clarity_flutter/latest/index This comprehensive example illustrates how to initialize the ClarityConfig object with your project ID and wrap your main Flutter application (MyApp) with the ClarityWidget. This setup is crucial for enabling Clarity to capture user interactions and screen views across your app. ```Dart import 'package:flutter/material.dart'; import 'package:clarity_flutter/clarity_flutter.dart'; void main() { final config = ClarityConfig( projectId: "your_project_id" // You can find it on the Settings page of Clarity dashboard. ); runApp(ClarityWidget( app: MyApp(), clarityConfig: config, )); } class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Clarity Flutter SDK Example'), ), body: Center( child: Text('Hello, Clarity!'), ), ), ); } } ``` -------------------------------- ### Example of Custom ClarityConfig Object Initialization Source: https://pub.dev/documentation/clarity_flutter/latest/index This snippet demonstrates how to create an instance of ClarityConfig with custom values for projectId, userId, and logLevel. This allows for fine-grained control over Clarity's behavior and data collection. ```Dart final config = ClarityConfig( projectId: "your_project_id", userId: "your_user_id", logLevel: LogLevel.Info, ); ``` -------------------------------- ### ClarityConfig Object API Reference and Configuration Options Source: https://pub.dev/documentation/clarity_flutter/latest/index This section provides a detailed API reference for the ClarityConfig object, outlining its properties such as projectId, userId, and logLevel. It describes each property's purpose, type, and possible values, guiding developers on how to customize Clarity's behavior. ```APIDOC ClarityConfig object: projectId (String): The unique identifier for your Clarity project. You can find it on the Settings page of Clarity dashboard. This ID is essential for routing data to the correct Clarity project. userId (String, optional): The unique identifier for the user. Must be a base-36 string larger than 0 and smaller than 1z141z4. If not provided, a Clarity generated user ID will be used instead. logLevel (LogLevel, optional): The logging level for Clarity. Defaults to LogLevel.Info if not provided (in debug builds). In non-debug (production) builds, loglevel is forced to None to eliminate any performance overhead. Possible values: LogLevel.Verbose: Detailed debug information. LogLevel.Debug: Debug information. LogLevel.Info: Informational messages. LogLevel.Warn: Warning messages. LogLevel.Error: Error messages. LogLevel.None: No logging. ``` -------------------------------- ### Add Clarity Flutter SDK Dependency to pubspec.yaml Source: https://pub.dev/documentation/clarity_flutter/latest/index This snippet shows how to add the clarity_flutter package as a dependency in your Flutter project's pubspec.yaml file. This step is essential for including the SDK in your application build. ```YAML dependencies: clarity_flutter: 1.0.0 ``` -------------------------------- ### Import Clarity Flutter Package in Dart File Source: https://pub.dev/documentation/clarity_flutter/latest/index This snippet demonstrates the necessary import statement to include the clarity_flutter package in your Dart code, typically in main.dart. This makes all Clarity SDK functionalities accessible within your application. ```Dart import 'package:clarity_flutter/clarity_flutter.dart'; ``` -------------------------------- ### Configuring Clarity Log Level for Troubleshooting in Flutter Source: https://pub.dev/documentation/clarity_flutter/latest/index To diagnose issues with the Clarity SDK, set the `logLevel` in `ClarityConfig` to `LogLevel.Verbose`. This provides detailed logs that can be filtered by `[Clarity]` to identify initialization errors or verify correct operation. ```Dart final config = ClarityConfig( projectId: "your_project_id", userId: "your_user_id", logLevel: LogLevel.Verbose, ); ``` -------------------------------- ### Unmasking Specific Content with ClarityUnmask in Flutter Source: https://pub.dev/documentation/clarity_flutter/latest/index The `ClarityUnmask` widget allows you to explicitly unmask content within an area that would otherwise be masked by Clarity. This is useful for displaying non-sensitive information in a generally masked region of your Flutter app. ```Dart import 'package:flutter/material.dart'; import 'package:clarity_flutter/clarity_flutter.dart'; class UnmaskedWidget extends StatelessWidget { @override Widget build(BuildContext context) { return ClarityUnmask( child: Text('Non-sensitive Information'), ); } } ``` -------------------------------- ### Masking Sensitive Information with ClarityMask in Flutter Source: https://pub.dev/documentation/clarity_flutter/latest/index Use the `ClarityMask` widget to ensure that its child widget's content is masked and not captured in Clarity recordings. This is essential for protecting sensitive user data within your Flutter application. ```Dart import 'package:flutter/material.dart'; import 'package:clarity_flutter/clarity_flutter.dart'; class MaskedWidget extends StatelessWidget { @override Widget build(BuildContext context) { return ClarityMask( child: Text('Sensitive Information'), ); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.