clean method

  1. @override
Future<Either<Failure, Unit>> clean()
override

Implementation

@override
Future<Either<Failure, Unit>> clean() async {
  try {
    final content = _yaml.readAsLinesSync()
      ..removeWhere((line) => line.trim().startsWith('#'));
    _yaml.writeAsStringSync(content.join('\n'));
    return const Right(unit);
  } catch (e) {
    return Left(UnknownFailure(cause: e.toString()));
  }
}