parseToList method

  1. @override
Future<List<String>> parseToList(
  1. String path, {
  2. String? packageName,
})
override

Implementation

@override
Future<List<String>> parseToList(String path, {String? packageName}) async {
  if (packageName != null) {
    path = '$packageName/$path';
  }
  final certificatesString = await rootBundle.loadString(path);
  final List<String> certificatesList = certificatesString
      .split('-----END CERTIFICATE-----')
      .where((cert) => cert.contains('-----BEGIN CERTIFICATE-----'))
      .map((cert) => '${cert.trim()}\r\n-----END CERTIFICATE-----')
      .toList();
  return certificatesList;
}