setCustomData static method

Future<AuthResult> setCustomData(
  1. List data
)

set user's custom data.

Implementation

static Future<AuthResult> setCustomData(List data) async {
  List list = [];
  for (var element in data) {
    Map map = {};
    map.putIfAbsent("definition", () => element["key"]);
    map.putIfAbsent("value", () => element["value"]);
    list.add(map);
  }
  var body = jsonEncode({'udfs': list});
  final Result result = await post('/api/v2/udfs/values', body);
  if (result.data["data"] is List) {
    currentUser?.setCustomData(result.data["data"] as List);
  }
  return AuthResult(result);
}