Dart Unit Converter
This package is for flexible data converting on Dart.
🎖 Installing
dependencies:
dart_unit_converter: ^0.0.3 + 1
⚡️ Import
import 'package:dart_unit_converter/dart_unit_converter.dart';
🎮 How To Use
- Data Convert
// FROM EXTENSION
dataValueController.text = parsedDataValue.convertDataToString(); // From Integer
// FROM FUNCTION
dataValueController.text = converter.continousDataConvert(parsedDataValue); // From Integer
// CUSTOM CONVERT
final converter = DataConverter();
dataValueController.text = converter
.convert(parsedDataValue, TypeDataConvert.bit, TypeDataConvert.megaByte)
.toString();
- Time Convert
import 'package:intl/date_symbol_data_local.dart';
import 'package:dart_unit_converter/dart_unit_converter.dart';
void main() {
runApp(const MyApp());
initializeDateFormatting();
setDefaultMessage(MessageLocalType.id); // Default = en
}
// ...
// ...
// ...
void useConverterFromSeconds() {
final parsedTimeValue = timeInputController.text;
timeValueController.text = parsedTimeValue.toStringTimeDiff(); // From String extension
final dateTime = DateTime.parse(parsedTimeValue);
timeValueController.text = dateTime.toStringTimeDiff(); // From DateTime extension
}
🐛 Bugs/Requests
❗️ Note
For help getting started with Flutter, view our online documentation.
For help on editing plugin code, view the documentation.
✨ Credits
- TIMEAGO: https://pub.dev/packages/timeago