LCOV - code coverage report
Current view: top level - lib/_ext - int_ext.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 0 9 0.0 %
Date: 2024-10-04 11:12:13 Functions: 0 0 -

          Line data    Source code
       1             : // Copyright 2023 The terCAD team. All rights reserved.
       2             : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3             : 
       4             : import 'dart:math';
       5             : 
       6             : import 'package:flutter/material.dart';
       7             : 
       8             : extension IntExt on int {
       9           0 :   static final Map<String, IconData> _cache = {};
      10             : 
      11           0 :   IconData toIcon() {
      12           0 :     if (_cache.containsKey(this)) {
      13           0 :       return _cache[this]!;
      14             :     } else {
      15             :       const String fontFamily = 'MaterialIcons';
      16           0 :       return IconData(this, fontFamily: fontFamily);
      17             :     }
      18             :   }
      19             : 
      20           0 :   String toByteSize() {
      21             :     const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
      22           0 :     if (this == 0) return '0 B';
      23           0 :     final i = (log(this) / log(1024)).floor();
      24           0 :     return '${(this / pow(1024, i)).toStringAsFixed(2)} ${sizes[i]}';
      25             :   }
      26             : }

Generated by: LCOV version 1.14