class Service {
// 工廠模式
factory Service() =>_getInstance();
static Service get instance => _getInstance();
static Service _instance;
Service._internal() {
// 初始化
}
static Service _getInstance() {
if (_instance == null) {
_instance = new Service._internal();
}
return _instance;
}
}
