clear method

  1. @override
Future<void> clear()
override

Clear all logs in this sink (if supported)

Implementation

@override
Future<void> clear() async {
  if (!isAvailable) return;

  try {
    await _sink?.close();

    if (_currentFile != null && await _currentFile!.exists()) {
      await _currentFile!.delete();
    }

    // Recreate the file
    if (_isInitialized && _currentFile != null) {
      _sink = _currentFile!.openWrite(mode: FileMode.write);
    }
  } catch (e) {
    // Ignore clear errors
    debugPrint('FileSink clear error: $e');
  }
}