Create Igel
This commit is contained in:
@@ -6,21 +6,21 @@ class IgelRepository {
|
||||
IgelRepository(this.api);
|
||||
|
||||
Future<List<Igel>> list() async {
|
||||
final res = await api.get('/igel');
|
||||
final res = await api.get<dynamic>('/igel');
|
||||
final list = (res as List).cast<Map<String, dynamic>>();
|
||||
return list.map(Igel.fromMap).toList();
|
||||
}
|
||||
|
||||
Future<Igel> create(String name, {String? note}) async {
|
||||
final res = await api.post('/igel', {'name': name, 'note': note});
|
||||
return Igel.fromMap(res);
|
||||
final res = await api.post<dynamic>('/igel', {'name': name, 'note': note});
|
||||
return Igel.fromMap(res as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
Future<void> update(int id, String name, {String? note}) async {
|
||||
await api.put('/igel/$id', {'name': name, 'note': note});
|
||||
await api.put<dynamic>('/igel/$id', {'name': name, 'note': note});
|
||||
}
|
||||
|
||||
Future<void> delete(int id) async {
|
||||
await api.delete('/igel/$id');
|
||||
await api.delete<dynamic>('/igel/$id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user