DEV Community

Cover image for Flutter(DART) Package For ALL-IN-ONE Random NEEDS!
JOSEPHYADUVANSHI
JOSEPHYADUVANSHI

Posted on • Originally published at Medium

Flutter(DART) Package For ALL-IN-ONE Random NEEDS!

In Flutter, the Random_x dart library can handle all your random requirements. random_x is a 100% free Dart open-source minimalist library built with the Dart SDK to make Flutter development more straightforward and joyful than ever.

Text("RandomX The Library For All Of Your Random Needs"),
Enter fullscreen mode Exit fullscreen mode

What is Random_X?

Random_x is a dart library that caters to all your random needs in Flutter. We've all been in situations where we needed to generate **random *STRINGS, INTEGERS, ADDRESSES, PSEUDO WORDS, GUIDs, UUIDs, RANDOM **COLORS*, **RANDOM *USERNAMES, NAMES, and a variety of other things while working on projects.*

How is it Different and Helpful?

To code the logic and algorithms yourself would take a lot of time and work on your part. Even if you wanted to install packages, they wouldn't give you everything you need to do random work. To counter this problem, I have created a package named **random_x* to get all of your random jobs done within a single package.*

CORE FEATURES

Text("HEY THERE! Please check our example app to have some idea")
Enter fullscreen mode Exit fullscreen mode
  • Usage

  • RandomX Features

  • Complete User Details

  • Random Colors

  • Random String

  • Random Credit Cards

  • Random UUID

  • Random Name

  • Random Addresses

  • Random UserAgent

  • And there is a whole lot Much More to explore….

  • Donate

USAGE

random_Xis a random library for all your random needs for your projects that you'll ever need (possibly). Include it in your build method like:

Text(RndX.generateName()),
Text(RndX.randomSSN(withdashes: true)),
Enter fullscreen mode Exit fullscreen mode

It also offers several configurable parameters in a variety of functions, which you can utilize and tailor to your needs. If you don’t want the customization, I’ve given default values for each function.

Text("RandomX The Library For All Of Your Random Needs"),
Enter fullscreen mode Exit fullscreen mode

Random_X Features

There are lots and lots of features included in the library which is practically messy to explain all here but I will try to give you an glimpse of some of an amazing features of the Package.

Complete User Details

Row(children:[
   Text(RndX.randomCompletePersonDetails().name),
   Text(RndX.randomCompletePersonDetails().gender),
   Text(RndX.randomCompletePersonDetails().race),
   Text(RndX.randomCompletePersonDetails().religion),
   Text(RndX.randomCompletePersonDetails().birthDay),
   ++ many more....
],)
Enter fullscreen mode Exit fullscreen mode

Random Colors

/// Generating a random color and applying it to the text.
          Text(
            "Generate Random Color",
            style: TextStyle(
              color: RndX.randomColor,
            ),
          ),
/// Generating a random color with alpha.
          Text(
            "Generate Random Color With Alpha",
            style: TextStyle(
              color: RndX.randomColorWithAlpha,
            ),
          ),
          /// Generating a random color with random opacity.
          Text(
            "Generate Random Color With Random Opacity",
            style: TextStyle(
              color: RndX.randomColorWithOpacity,
            ),
          ),
          /// Generating a random color with random opacity and greenish color.
          Text(
            "Generate Random Color With Random Opacity Greenish",
            style: TextStyle(
              color: RndX.randomColorWithOpacityAndGreen,
            ),
          ),
          /// Generating a random color with random opacity and greenish.
          Text(
            "Generate Random Color With Random Opacity Redish",
            style: TextStyle(
              color: RndX.randomColorWithOpacityAndGreen,
            ),
          ),
          /// Generating a random primary color and applying it to the text.
          Text(
            "Generate Random Primary Color",
            style: TextStyle(
              color: RndX.randomPrimaryColor,
            ),
          ),
          /// Generating a random accent color.
          Text(
            "Generate Random Accent Color",
            style: TextStyle(
              color: RndX.randomAccentColor,
            ),
          ),
Enter fullscreen mode Exit fullscreen mode

Random Strings

Text(RndX.randomString(type: RandomCharStringType.alphaNumerical, length: 10)),
The parameters are type and Length which you can easily customize as per your needs.
Enter fullscreen mode Exit fullscreen mode

Random Credit Cards

Row(
      children: [
        Text(RndX.randomFullCreditCard().ccn),
        Text(RndX.randomFullCreditCard().expiryDate),
        Text(RndX.randomFullCreditCard().cvv),
        Text(RndX.randomFullCreditCard().cardType),
],
    )
Enter fullscreen mode Exit fullscreen mode

Random UUID

Text(RndX.genUUID()),
Enter fullscreen mode Exit fullscreen mode

It generated version 4 of UUID with very subtle algorithm.

Random Name

Text(RndX.generateName()),
Enter fullscreen mode Exit fullscreen mode

Random Addresses

Row(
      children: [
        Text(RndX.randomAddress().address1),
        Text(RndX.randomAddress().address2),
        Text(RndX.randomAddress().city),
        Text(RndX.randomAddress().postalCode),
        Text(RndX.randomAddress().state),
        Text(RndX.randomAddress().coordinates.lat.toString()),
        Text(RndX.randomAddress().coordinates.lng.toString()),
      ],
    );
Enter fullscreen mode Exit fullscreen mode

You can get random USA addresses using randomAddress function and then using the same instance to access the other instances of addresses.

Random UserAgent

Row(
      children: [
        Text(RndX.getRandomUA()),
        Text(RndX.getRandomUA(count: 4, type: UserAgentType.macOs), ),
        Text(RndX.getRandomUA(count: 4, type: UserAgentType.mobile), ),
      ],
    );
Enter fullscreen mode Exit fullscreen mode

You can easily generate random UA with custom configuration as well as shown above, there are few more parameters more there you can explore yourselves.

It’s just an introduction to some of the features of the Package; You can explore yourself more cause I’ve got so much for you, and I’m so excited for you to try.

CONCLUSION

CONCLUSION

I think that’s all for now; you can go check out the Library; it’s open source, so you can contribute as well. You may also show your support by sharing this post with your friends who may need it or by giving it a like❤️ on pub.dev and giving star ⭐️ on GITHUB REPO. If you have any constructive comments or recommendations, please share them with me.
Thank you for reading thus far; I hope to see you in the future article.

LINKS

  1. GitHub Repository

  2. Random_X Package

  3. My GitHub
    josephyaduvanshi — Overview

More blogs from me:

Dart First Then Flutter. Learn Dart From Scratch.
A Flutter App to retrieve Visa Dates automatically using telegram bot API.
Flutter Beautiful Login/SignUp Responsive UI Design with animation.
Flutter vs. React Native: 2022’s best option!?
How will artificial intelligence change the world in the next ten years?

Top comments (0)