Fakultas Ilmu Komputer UI

network_model.dart 412 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class NetworkModel<T> {
  Status status;
  T data;
  String message;

  NetworkModel.loading(this.message) : status = Status.LOADING;
  NetworkModel.completed(this.data) : status = Status.COMPLETED;
  NetworkModel.error(this.message) : status = Status.ERROR;

  @override
  String toString() {
    return "Status : $status \n Message : $message \n Data : $data";
  }
}

enum Status { LOADING, COMPLETED, ERROR }