create method
Implementation
Future<List<QBCustomObject?>> create(
{String? className, Map<String, Object>? fields, List<Map<String, Object>>? objects}) async {
Map<String, Object> data = Map();
if (className != null) {
data["className"] = className;
}
if (fields != null) {
data["fields"] = fields;
}
if (objects != null) {
data["objects"] = objects;
}
Object? result = await _customObjectsModule.invokeMethod(CREATE_METHOD, data);
List<QBCustomObject?> customObjects = [];
if (result is LinkedHashMap) {
QBCustomObject? customObject = QBCustomObjectMapper.mapToQBCustomObject(result);
customObjects.add(customObject);
}
if (result is List) {
for (final item in result) {
QBCustomObject? customObject = QBCustomObjectMapper.mapToQBCustomObject(item as Map<dynamic, dynamic>);
customObjects.add(customObject);
}
}
return customObjects;
}