create method

Future<Map<String, dynamic>> create(
  1. String index,
  2. String collection, {
  3. Map<String, dynamic> mapping = const {},
})

Creates a new collection, in the provided index.

You can also provide an optional mapping that allow you to exploit the full capabilities of our persistent data storage layer.

Implementation

Future<Map<String, dynamic>> create(
  String index,
  String collection, {
  Map<String, dynamic> mapping = const {},
}) async {
  final response = await kuzzle.query(KuzzleRequest(
    controller: name,
    action: 'create',
    index: index,
    collection: collection,
    body: mapping,
  ));

  return response.result as Map<String, dynamic>;
}