2021-01-14 21:48:05 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:selfprivacy/logic/models/message.dart';
|
|
|
|
|
2021-01-19 12:05:40 +00:00
|
|
|
class ConsoleModel extends ChangeNotifier {
|
2022-05-24 18:55:39 +00:00
|
|
|
final List<Message> _messages = [];
|
2021-01-14 21:48:05 +00:00
|
|
|
|
|
|
|
List<Message> get messages => _messages;
|
|
|
|
|
2022-06-05 19:36:32 +00:00
|
|
|
void addMessage(final Message message) {
|
2021-01-14 21:48:05 +00:00
|
|
|
messages.add(message);
|
|
|
|
notifyListeners();
|
2022-12-31 04:58:20 +00:00
|
|
|
// Make sure we don't have too many messages
|
|
|
|
if (messages.length > 500) {
|
|
|
|
messages.removeAt(0);
|
|
|
|
}
|
2021-01-14 21:48:05 +00:00
|
|
|
}
|
|
|
|
}
|