
import 'package:flutter/material.dart';
import 'package:twong/api/index.dart';
import 'package:twong/utils/index.dart';

class OrderNumModel with ChangeNotifier {
  dynamic _data;
  bool _waiting = false;
  OrderNumModel();

  dynamic get data  {
    if(_data == null && Cache.token != null && !_waiting) {
      _waiting = true;
      Network.inst.getOrderData();
    }

    return _data;
  }

  void update(dynamic data) {
    _waiting = false;
    this._data = data;
    notifyListeners();
  }
}