Skip to content

Instantly share code, notes, and snippets.

View RoyalCoder88's full-sized avatar
🏠
Working from home

Dorin Buraca RoyalCoder88

🏠
Working from home
View GitHub Profile
@tensor-programming
tensor-programming / example.dart
Last active January 31, 2023 19:35
Flutter Column Animated expanded widgets
class ExpandableText extends StatefulWidget {
ExpandableText(this.text);
final String text;
@override
_ExpandableTextState createState() => _ExpandableTextState();
}
@zzpmaster
zzpmaster / formatBytes.dart
Last active June 4, 2024 23:11
convert bytes to kb mb in dart
static String formatBytes(int bytes, int decimals) {
if (bytes <= 0) return "0 B";
const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
var i = (log(bytes) / log(1024)).floor();
return ((bytes / pow(1024, i)).toStringAsFixed(decimals)) +
' ' +
suffixes[i];
}