You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
flutter_custom_calendar/lib/cache_data.dart

35 lines
605 B

import 'package:flutter_custom_calendar/model/date_model.dart';
/**
* 保存一些缓存数据,不用再次去计算日子
*/
class CacheData {
//私有构造函数
CacheData._();
static CacheData _instance;
static CacheData get instance => _instance;
Map<DateModel, List<DateModel>> monthListCache = Map();
Map<DateModel, List<DateModel>> weekListCache = Map();
static CacheData getInstance() {
if (_instance == null) {
_instance = new CacheData._();
}
return _instance;
}
void clearData(){
monthListCache.clear();
weekListCache.clear();
}
}