post method

Future<int> post(
  1. DataPoint data
)

Uploads data.

Returns the server-generated ID for this data point.

Implementation

Future<int> post(DataPoint data) async {
  final response = await service._post(
    dataEndpointUri,
    body: json.encode(data),
  );

  // we expect a map with the ID in the response
  Map<String, dynamic> responseJson =
      service._handleResponse(response) as Map<String, dynamic>;
  return responseJson["id"] as int;
}