Context: I want to register new customer to my API server(with package:http/http.dart).
Problem: This error was thrown:
flutter: type 'List<Map<String, String?>>' is not a subtype of type 'String' in type cast
I think flutter is complaining about the type of metadata property, but I have no clue on how to resolve it.
I tried to create a Map<dynamic, dynamic> object but it does not help as well.
var response = await _httpClient.post(
createCustomerUrl,
body: {
'email': customerModel.email,
'first_name': customerModel.firstName,
'last_name': customerModel.lastName,
'password': customerModel.password,
'username': customerModel.username,
'meta_data': [
{'key': 'birthdate', 'value': customerModel.birthdate},
],
},
);