A Flutter Package to convert any type to any type

Getting started

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

  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


  • 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
  • To get int value from string example
  • 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.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

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"
              .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,, false respectively

Single Underline

"This is Single underline"

Double Underline

"This is Double underline"

Single Dashed Underline

"This is Single Dashed underline"

Double Dashed Underline

"This is Double Dashed underline"

Single Dotted Underline

"This is Single Dotted underline"

Double Dotted Underline

"This is Double Dotted underline"


    children: [
      "Text 1".toText(),
      "Text 2".toText(),
      VerticalGap(gap: 12,),
        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),


With this Library you can convert any to any