updateUser method

  1. @override
Future<bool?> updateUser(
  1. Map<String, dynamic> data
)
override

Implementation

@override
Future<bool?> updateUser(Map<String, dynamic> data) {
  final profile = <String, dynamic>{
    if (data['email'] != null) 'email': data['email'],
    if (data['mobileNumber'] != null) 'mobileNumber': data['mobileNumber'],
    if (data['name'] != null) 'name': data['name'],
    if (data['avatarUrl'] != null) 'avatarUrl': data['avatarUrl'],
    if (data['customAttributes'] != null) ...data['customAttributes'],
  };
  final user = <String, dynamic>{
    if (profile.isNotEmpty) 'profile': profile,
    if (data['profileOnce'] != null) 'profileOnce': data['profileOnce'],
    if (data['unsubscribeEmail'] != null)
      'unsubscribeEmail': data['unsubscribeEmail'],
    if (data['unsubscribeTexting'] != null)
      'unsubscribeTexting': data['unsubscribeTexting'],
    if (data['tags'] != null) 'tags': data['tags'],
    if (data['language'] != null) 'language': data['language'],
  };
  return _runWithCallback((callback) {
    channel_talk_service.updateUser(
      'updateUser',
      user.jsify(),
      callback,
    );
  });
}