1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-02-11 11:12:38 +00:00
comunicmobile/lib/models/api_response.dart

20 lines
409 B
Dart
Raw Normal View History

2019-04-22 19:16:26 +02:00
import 'dart:convert';
/// API response
///
/// @author Pierre HUBERT
class APIResponse {
final int code;
final String content;
const APIResponse(this.code, this.content) : assert(code != null);
List<dynamic> getArray() => jsonDecode(this.content);
Map<String, dynamic> getObject() => jsonDecode(this.content);
2019-05-18 18:48:12 +02:00
/// Check if the request is successful or not
bool get isOK => code == 200;
2019-04-22 19:16:26 +02:00
}