any_to_any_converter

A Flutter Package to convert any type to any type

Getting started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  ...
  any_to_any_converter: any

In your library add the following import:

import 'package:any_to_any_converter/any_to_any_converter.dart';

How to use

String

  • To first letter of string capital example
 "your string".toFirstCapital() 

and you get result Your string

  • To all first letter of string capital example
 "your string".toEveryFirstCapital() 

and you get result Your String

  • To set in camel case of string example
 "your string".toCamelCase() 

and you get result yOuR StRiNg

  • To get only first character of string example
 "Your string".toSingleLetter() 

and you get result Y

  • To get all first letter of string with joinWith example
 "your string".toEverySingleLetter(joinWith: ".") 

and you get result Y.S

  • To get double value from string example
 "1.2".toDouble() 
  • To get int value from string example
 "1".toInt() 
  • To get date with any format you want example
 "2021-05-10".toDate(format: FormatDate.dmy) 

and you get result 10/05/2021

Date Format

Format NameResult
FormatDate.dmyDash16-08-2021
FormatDate.mdyDash08-16-2021
FormatDate.ymdDash2021-08-16
FormatDate.ydmDash2021-16-08
FormatDate.dmy16/08/2021
FormatDate.mdy08/16/2021
FormatDate.ymd2021/08/16
FormatDate.ydm2021/16/08
FormatDate.dmyDash1216-08-2021 11:30 PM
FormatDate.dmyDash12WithSec16-08-2021 11:30:10 PM
FormatDate.mdyDash1208-16-2021 11:30 PM
FormatDate.mdyDash12WithSec08-16-2021 11:30:10 PM
FormatDate.ymdDash122021-08-16 11:30 PM
FormatDate.ymdDash12WithSec2021-08-16 11:30:10 PM
FormatDate.ydmDash122021-16-08 11:30 PM
FormatDate.ydmDash12WithSec2021-16-08 11:30:10 PM
FormatDate.dmy1216/08/2021 11:30 PM
FormatDate.dmy12WithSec16/08/2021 11:30:10 PM
FormatDate.mdy1208/16/2021 11:30 PM
FormatDate.mdy12WithSec08/16/2021 11:30:10 PM
FormatDate.ymd122021/08/16 11:30 PM
FormatDate.ymd12WithSec2021/08/16 11:30:10 PM
FormatDate.ydm122021/16/08 11:30 PM
FormatDate.ydm12WithSec2021/16/08 11:30:10 PM
FormatDate.dmyDash2416-08-2021 23:30
FormatDate.dmyDash24WithSec16-08-2021 23:30:10
FormatDate.mdyDash2408-16-2021 23:30
FormatDate.mdyDash24WithSec08-16-2021 23:30:10
FormatDate.ymdDash242021-08-16 23:30
FormatDate.ymdDash24WithSec2021-08-16 23:30:10
FormatDate.ydmDash242021-16-08 23:30
FormatDate.ydmDash24WithSec2021-16-08 23:30:10
FormatDate.dmy2416/08/2021 23:30
FormatDate.dmy24WithSec16/08/2021 23:30:10
FormatDate.mdy2408/16/2021 23:30
FormatDate.mdy24WithSec08/16/2021 23:30:10
FormatDate.ymd242021/08/16 23:30
FormatDate.ymd24WithSec2021/08/16 23:30:10
FormatDate.ydm242021/16/08 23:30
FormatDate.ydm24WithSec2021/16/08 23:30:10
FormatDate.time1211:30 PM
FormatDate.time12WithSec11:30:10 PM
FormatDate.time2423:30
FormatDate.time24WithSec23:30:10

String to Text

"This is Text".toText(),
"This is H1 Text".toH1Text(context),
"This is H2 Text".toH2Text(context),
"This is H3 Text".toH3Text(context),
"This is H4 Text".toH4Text(context),
"This is H5 Text".toH5Text(context),
"This is H6 Text".toH6Text(context),
"This is Body Text 1".toBodyText1(context),
"This is Body Text 2".toBodyText2(context),
"This is Caption".toCaption(context),
"This is Subtitle 1".toSubtitle1(context),
"This is Subtitle 2".toSubtitle2(context),

Using copyWith in Text

Parameter of copyWith as same as Text except data, Parameters of Text have text as prefix and Parameters of TextStyle has style as prefix

"This is H1 Text with fontSize 20"
              .toH1Text(context)
              .copyWith(styleFontSize: 20),

Underline in any Widget

There are different type of underline like Single Underline, Single dashed Underline, Single dotted Underline, Double Underline, Double dashed Underline, Double dotted Underline all type of underline take 4 parameter thickness, gapWithText, color, isCenter by default its value is 1, 2, Colors.black, false respectively

Single Underline

"This is Single underline"
              .toText()
              .underline(),

Double Underline

"This is Double underline"
              .toText()
              .doubleUnderline(),

Single Dashed Underline

"This is Single Dashed underline"
              .toText()
              .dashUnderline(),

Double Dashed Underline

"This is Double Dashed underline"
              .toText()
              .doubleDashUnderline(),

Single Dotted Underline

"This is Single Dotted underline"
              .toText()
              .dottedUnderline(),

Double Dotted Underline

"This is Double Dotted underline"
              .toText()
              .doubleDottedUnderline(),

Gaps

Column(
    children: [
      "Text 1".toText(),
      VerticalGap(),
      "Text 2".toText(),
      VerticalGap(gap: 12,),
      Row(
        children: [
          "Text 3".toText(),
          HorizontalGap(gap: 20,),
          "Text 4".toText()
        ],
      )
    ],
),

also use as

VerticalGap.v12, // VerticalGap(gap: 12),
VerticalGap.v14, // VerticalGap(gap: 14),
VerticalGap.v16, // VerticalGap(gap: 16),
VerticalGap.v18, // VerticalGap(gap: 18),
VerticalGap.v20, // VerticalGap(gap: 20),
VerticalGap.v22, // VerticalGap(gap: 22),
VerticalGap.v24, // VerticalGap(gap: 24),
VerticalGap.v26, // VerticalGap(gap: 26),
VerticalGap.v28, // VerticalGap(gap: 28),
VerticalGap.v30, // VerticalGap(gap: 30),

HorizontalGap.v12, // HorizontalGap(gap: 12),
HorizontalGap.v14, // HorizontalGap(gap: 14),
HorizontalGap.v16, // HorizontalGap(gap: 16),
HorizontalGap.v18, // HorizontalGap(gap: 18),
HorizontalGap.v20, // HorizontalGap(gap: 20),
HorizontalGap.v22, // HorizontalGap(gap: 22),
HorizontalGap.v24, // HorizontalGap(gap: 24),
HorizontalGap.v26, // HorizontalGap(gap: 26),
HorizontalGap.v28, // HorizontalGap(gap: 28),
HorizontalGap.v30, // HorizontalGap(gap: 30),

Libraries

any_to_any_converter
With this Library you can convert any to any