update<T> method

Future<bool> update<T>(
  1. String key,
  2. Map<String, dynamic> value
)

Implementation

Future<bool> update<T>(String key, Map<String, dynamic> value) async {
  print(value);
  final response = await http.put(
    Uri.parse(_url! + '/' + key + '.json'),
    body: jsonEncode(value),
  );

  if (response.statusCode == 200) {
    print(response.statusCode);
    return true;
  } else {
    print('Request failed with status: ${response.statusCode}.');
    return false;
  }
}