CareTaker.dart 307 B

1234567891011121314151617181920
  1. import 'Memo.dart';
  2. class CareTaker{
  3. List<Memo> mementoList = [];
  4. void add(Memo state){
  5. mementoList.add(state);
  6. if (mementoList.length>3) {
  7. mementoList.removeAt(0);
  8. }
  9. }
  10. Memo get(int index){
  11. return mementoList[index];
  12. }
  13. Memo getLast(){
  14. return mementoList.last;
  15. }
  16. }