connect_flutter_plugin
Overview
The Flutter plugin can be instrumented with your Flutter applications so you can capture user interactions and application data and then play back and analyze the data with Acoustic Connect. For more information, see the Flutter SDK overview.
Getting Started
To start working with the Connect Flutter plugin, Add the plugin to your application and configure Connect. Refer to Installation instructions.
Build the sample app
Example sample app files you can use to build to view quick example implementations of all core functionalities are provided with the plugin. To start working with the example files, refer to Build the sample app.
Logging Configuration
The Connect Flutter Plugin provides configurable logging levels to control SDK log verbosity for Flutter level code. This setting does not affect logs generated by native modules.
Quick Start
No configuration needed! The SDK automatically adapts:
- Debug builds → Full logging (debug + trace + error)
- Release builds → Errors only
Log Levels
| Level | Description |
|---|---|
ConnectLogLevel.auto |
Default - Adapts to build mode automatically |
ConnectLogLevel.off |
No logging |
ConnectLogLevel.error |
Only error messages |
ConnectLogLevel.debug |
Debug and error messages (always, regardless of build mode) |
ConnectLogLevel.trace |
All messages including trace (most verbose) |
Usage Examples
Use Default (Auto Mode)
import 'package:connect_flutter_plugin/connect_flutter_plugin.dart';
void main() {
// No configuration needed - auto mode is default
runApp(Connect(child: const MyApp()));
}
Disable All Logging
void main() {
PluginConnect.setLogLevel(ConnectLogLevel.off);
runApp(Connect(child: const MyApp()));
}
Force Verbose Logging (for debugging)
void main() {
PluginConnect.setLogLevel(ConnectLogLevel.trace);
runApp(Connect(child: const MyApp()));
}
Check Current Log Level
ConnectLogLevel currentLevel = PluginConnect.getLogLevel();
print('Current log level: $currentLevel');
Best Practices
- Use auto mode (default) for most cases - Zero configuration, automatically adapts
- Configure before
Connect.init()to capture all initialization logs - Use
ConnectLogLevel.offorConnectLogLevel.errorin production to minimize logs - Use
ConnectLogLevel.traceonly when troubleshooting - it's very verbose
API Methods
// Set log level
PluginConnect.setLogLevel(ConnectLogLevel.trace);
// Get current log level
ConnectLogLevel level = PluginConnect.getLogLevel();