LCOV - code coverage report
Current view: top level - lib/encryption/utils - base64_unpadded.dart (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 5 5
Test Date: 2025-01-14 13:39:53 Functions: - 0 0

            Line data    Source code
       1              : import 'dart:convert';
       2              : import 'dart:typed_data';
       3              : 
       4              : /// decodes base64
       5              : ///
       6              : /// Dart's native [base64.decode()] requires a padded base64 input String.
       7              : /// This function allows unpadded base64 too.
       8              : ///
       9              : /// See: https://github.com/dart-lang/sdk/issues/39510
      10           11 : Uint8List base64decodeUnpadded(String s) {
      11           44 :   final needEquals = (4 - (s.length % 4)) % 4;
      12           33 :   return base64.decode(s + ('=' * needEquals));
      13              : }
      14              : 
      15            2 : String encodeBase64Unpadded(List<int> s) {
      16            6 :   return base64Encode(s).replaceAll(RegExp(r'=+$', multiLine: true), '');
      17              : }
        

Generated by: LCOV version 2.0-1