flutter_string_converter 0.0.1 copy "flutter_string_converter: ^0.0.1" to clipboard
flutter_string_converter: ^0.0.1 copied to clipboard

This Flutter Package for converting string to date, int, double or set as you want. But the only condition is that the string is in format of that convertible type

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_string_converter/flutter_string_converter.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  final String _string = "this is a boy";
  final String _name = "Rahul Gandhi";
  final String _date = "2021-08-16 23:30:23";
  final String _double = "1.2";
  final String _int = "1";


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Examples'),
      ),
      body: ListView(
        children: [
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '$_string.toFirstCapital() => ${_string.toFirstCapital()}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '$_string.toEveryFirstCapital() => ${_string.toEveryFirstCapital()}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '$_name.toSingleLetter() => ${_name.toSingleLetter()}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '${_string.toCamelCase()}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '${_date.toDate(format: FormatDate.dmyDash24WithSec)}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '$_double type = ${_double.runtimeType} =>$_double type =  ${_double.toDouble().runtimeType}',
              ),
            ),
          ),
          Center(
            child: Padding(
              padding: const EdgeInsets.all(8.0),
              child: Text(
                '$_int type = ${_int.runtimeType} =>$_int type =  ${_int.toInt().runtimeType}',
              ),
            ),
          ),
        ],
      ),
    );
  }
}
1
likes
120
pub points
14%
popularity

Publisher

unverified uploader

This Flutter Package for converting string to date, int, double or set as you want. But the only condition is that the string is in format of that convertible type

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, intl

More

Packages that depend on flutter_string_converter