dart_data_type_parser 0.0.2 copy "dart_data_type_parser: ^0.0.2" to clipboard
dart_data_type_parser: ^0.0.2 copied to clipboard

A Dart package that extends built-in data types like double, int, and String with useful methods. It provides functionality for formatting numbers, converting strings to numbers, handling pluralizatio [...]

example/main.dart

import 'package:dart_data_type_parser/dart_data_type_parser.dart';

void main() {
  // Double Extensions
  double? value1 = 123.456;
  print("Formatted Double (2 decimal places): ${value1.toFormattedString()}"); // Outputs: 123.46

  double? value2 = 123;
  print("Formatted Double (whole number): ${value2.toFormattedString()}"); // Outputs: 123

  double? value3 = null;
  print("Formatted Double (null value): ${value3.toFormattedString()}"); // Outputs: 0

  // Int Extensions
  int number = 42;
  print("Integer to String: ${number.toStringExt()}"); // Outputs: 42

  // String Extensions
  String text1 = "hello_world";
  print("String to Snake Case: ${text1.toSnakeCase()}"); // Outputs: hello_world

  String text2 = "123.45";
  print("String to Double: ${text2.toDouble()}"); // Outputs: 123.45

  String text3 = "child";
  print("String to Plural Case: ${text3.toPluralCase()}"); // Outputs: children

  String text4 = "API";
  print("String to Title Case: ${text4.toTitleCase()}"); // Outputs: API

  String text5 = "helloWorld";
  print("String to Title Case (camelCase): ${text5.toTitleCase()}"); // Outputs: Hello World
}
0
likes
130
points
403
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart package that extends built-in data types like double, int, and String with useful methods. It provides functionality for formatting numbers, converting strings to numbers, handling pluralization (including irregular plurals), and converting strings to different formats like title case and snake case.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, fluttertoast

More

Packages that depend on dart_data_type_parser