create method
Future<ConversationClient?>
create({
- required String jwtToken,
- Properties properties = const Properties(),
Create a ConversationClient.
Implementation
Future<ConversationClient?> create({
required String jwtToken,
Properties properties = const Properties(),
}) async {
assert(jwtToken.isNotEmpty);
conversationClient = ConversationClient();
//TODO Needs to throw a better error when trying
// to create with a bad jwtToken. The current error is "Client timeout reached"
// (happens in iOS, not sure about Android)
final ConversationClientData result;
try {
result = await pluginApi.create(jwtToken, properties.toPigeon());
conversationClient
?.updateFromMap(Map<String, dynamic>.from(result.encode() as Map));
} catch (e) {
conversationClient = null;
log('create => onError: $e');
rethrow;
}
return conversationClient;
}