initialize method
Future<bool>
initialize({
- String? applicationSecret,
- String? apiKey,
- String? apiSecret,
- String? domain,
- String? userId,
- bool? developmentApns,
override
Initialize Dimelo/Engage Digital Messaging SDK on the native side.
This method must be called before using any other functionality.
Parameters:
apiKey- Your Dimelo API key (required)domain- The service domain/endpoint (required)userId- Optional external user ID to bind the sessionapplicationSecret- Optional application secretapiSecret- Optional API secretdevelopmentApns- Whether to use development APNS (iOS only)
Returns true if initialization was successful, false otherwise.
Implementation
@override
Future<bool> initialize({
String? applicationSecret,
String? apiKey,
String? apiSecret,
String? domain,
String? userId,
bool? developmentApns,
}) async {
try {
// Prepare parameters for native SDK initialization
final result = await methodChannel.invokeMethod<bool>('initialize', <String, dynamic>{
'applicationSecret': applicationSecret,
'apiKey': apiKey,
'apiSecret': apiSecret,
'domain': domain,
'userId': userId,
'developmentApns': developmentApns,
});
// Return result or false if null
return result ?? false;
} on PlatformException catch (e) {
// Log error and return false on platform exception
debugPrint('Failed to initialize Dimelo: ${e.message}');
return false;
}
}