loadFromFile method

void loadFromFile()

Implementation

void loadFromFile() async {
  if (await fs.fileExists(_historyFilePath)) {
    try {
      final content = await fs.readFileAsString(_historyFilePath);
      if (content != null) {
        final lines = content.split('\n');
        _history.addAll(lines.where((line) => line.trim().isNotEmpty));
        _currentIndex = _history.length;
      }
    } catch (e) {
      print('Failed to load history: $e');
    }
  }
}