initialize method
Initializes the Appero SDK.
Must be called before using any other SDK methods.
apiKey - Your Appero API key
userId - Optional user identifier for tracking feedback across sessions
debug - Whether to enable debug logging (default: false)
Throws PlatformException if initialization fails.
Example:
await Appero.instance.initialize(
apiKey: 'your_api_key',
userId: 'user123',
);
Implementation
Future<void> initialize({
required String apiKey,
String? userId,
bool debug = false,
}) async {
await _methodChannel.invokeMethod('initialize', {'apiKey': apiKey, 'userId': userId, 'debug': debug});
_feedbackPromptSubscription = shouldShowFeedbackPrompt.listen((shouldShow) {
if (shouldShow) {
_methodChannel.invokeMethod('showFeedbackPrompt');
} else {
_methodChannel.invokeMethod('dismissApperoPrompt');
}
});
}