ultimate_data_generator 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Ultimate Data Generator #

Ultimate Data Generator (UDG) is the most complete offline data generator for prototyping using Flutter. It gives you access to a lot of data that does not just look like place holder text but actual real looking data! By using this package, you will have access to diverse elements from basic data to a little bit more advanced one such as name, surnames, email, comments(classified by category), food names and ingredients used for them and so much more.

The online documentation

My instagram :P

The demo Apk

Quick usage #

The ultimate data generator can generate datas from 6 different categories, to know more about them please read The online documentation. Image generation is also supported (as local path). To use UDG you should first import the package then select the class you would like to use depending on what you want to generate (more in The online documentation. )

import'package:ultimate_data_generator/ultimate_data_generator.dart';
//rest of code
Container(
    color: Colors.pink,
    child:Image.asset(HumanGen.generateMaleImage(),fit: BoxFit.fill,),
)

A Short gif showcasing the demo app #

Usage and possible Limitations #

Well as far as I am concerned, I did not find any bug during my tests.However, due to the nature of this package, I would strongly recomment to generate your data in the model before placing your widget inside a listView.builder

generating data inside a list

ListView.builder(
     itemCount: litems.length,
     itemBuilder: (BuildContext ctxt, int Index) {
	 return Container(
          color: Colors.pink,
          child:Image.asset(HumanGen.generateMaleImage(),fit: BoxFit.fill,),
     );
   }
 )
  1. generate data from your model/ data manager
  2. create a list and feed it with the widget created by your data manager
//Datamanager.dart
// user is a widget, lets say a xard
List<user> createUser (int number)
{
	 list<user> userList;
	 for(int i=0;i<number;i++)
	 {
	 	userList.add(
			user(
				name: HumanGen.generateAFullName(),
				email: HumanGen.generateEmailFromMostRecentName(),
				profilePicturePath: HumanGen.generateMaleImage(),
				age: HumanGen.generateMidAdultAge(useExtension = true),
				profession: IndustryGen.generateJobOccupation(),
				homeLocation:PlacesGen.generateLocalAddress(),
			)
		)
	 }
}

now that you have you data, you can feed it into the listview

//Somewhere in your code
ListView.builder
(
     itemCount: userList.length,
     itemBuilder: (BuildContext ctxt, int Index) {
     return userList[index];
  }
)

Conclusion #

Thank you for using my package, feel free to contact me by mail or on my instagram if you have any issue, I will be happy to help

For help getting started with Flutter, view The
online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.0.1] - TODO: Add release date. #

  • initial release.

[0.0.2] - Documentation. #

  • Updated the documentation.

[1.0.0] - Bug Fix. #

  • Fixed an issue with the method that generate a phone number.
  • Fixed some other mathematic methods
  • Removed print statements
  • Meta description updated

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Ultimate data generator\nUDG'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    //his is rought and does not support landscape mode nor safe area
    double hbloc = MediaQuery.of(context).size.width / 100;
    double vbloc = MediaQuery.of(context).size.height / 100;
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(
          widget.title,
          textAlign: TextAlign.center,
        ),
      ),
      body: SingleChildScrollView(
        physics: BouncingScrollPhysics(),
        child: Center(
          child: SafeArea(
            child: Column(
              children: <Widget>[
                Center(
                  child: Text(
                    'I will only showcase 3 methods per class\nfor time sake  :)\nInstagram: emilecode',
                    textAlign: TextAlign.center,
                    style: TextStyle(color: Colors.red),
                  ),
                ),
                CardElement(
                  textColor: Colors.orange,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'General purpose category (gen class)',
                  methodName: 'generatePercentage() → int:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generatePercentage()', detailString: Gen.generatePercentage().toString(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.orange,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'General purpose category (gen class)',
                  methodName: 'generateNumberinRange({@required int a, int b}) → Int:',
                  onTap: () {
                     Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateNumberinRange\n({int 9, int 100})', detailString: Gen.generateNumberInRange(a: 9,b: 100).toString(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.orange,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'General purpose category (gen class)',
                  methodName: 'generateRating() → int:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateRating()', detailString: Gen.generateRating().toString(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.blue,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The SocialMediaGen class',
                  methodName: 'generateRandomComment() → String:',
                  onTap: () {
             Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateRandomComment()', detailString: SocialMediaGen.generateRandomComment(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.blue,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The SocialMediaGen class',
                  methodName: 'generateABio() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateABio()', detailString: SocialMediaGen.generateABio(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.blue,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The SocialMediaGen class',
                  methodName: 'generateHotelReview() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateHotelReview()', detailString: SocialMediaGen.generateHotelReview(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.deepPurpleAccent,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The PlacesGen class',
                  methodName: 'generateLocalAddress() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateLocalAddress()', detailString: PlacesGen.generateLocalAddress(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.deepPurpleAccent,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The PlacesGen class',
                  methodName: 'generateAnHospitallName() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateAnHospitallName()', detailString: PlacesGen.generateAnHospitallName(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.deepPurpleAccent,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The PlacesGen class',
                  methodName: 'generateSchoolName() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateSchoolName()', detailString: PlacesGen.generateSchoolName(),)));
                  },
                ),
                CardElement(
                  textColor: Colors.red,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The HumanGen class',
                  methodName: 'generateAGirlFirstName() → String:',
                  onTap: () {
                 Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateAGirlFirstName()', detailString: HumanGen.generateAGirlFirstName(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.red,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The HumanGen class',
                  methodName: 'generateRandomEmail() → String:',
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateRandomEmail()', detailString: HumanGen.generateRandomEmail(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.red,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The HumanGen class',
                  methodName:
                      'generatePhoneNumber({int length, int startingwith, bool shallFormat, int countryCode}) → String:',
                  onTap: () {
                  Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generatePhoneNumber\ncountry code is false', detailString: HumanGen.generatePhoneNumber(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.pink,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The IndustryGen class',
                  methodName: 'generateCarBrandName() → String:',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateCarBrandName()', detailString: IndustryGen.generateCarBrandName(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.pink,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The IndustryGen class',
                  methodName: 'generateJobOccupation() → String:',
                  onTap: () {
                  Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateJobOccupation()', detailString: IndustryGen.generateJobOccupation(),)));

                  },
                ),
                CardElement(
                  textColor: Colors.pink,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The IndustryGen class',
                  methodName: 'generateTechCompanyName() → String:',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage( methodName: 'generateTechCompanyName()', detailString: IndustryGen.generateTechCompanyName(),)));

                  },
                ),
                Center(
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      'Now "some" images :) ',
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.red),
                    ),
                  ),
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The HummanGen class',
                  methodName: 'generateTeenMaleImage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateTeenMaleImage()', detailString: HumanGen.generateTeenMaleImage(),)));

                  },
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The HummanGen class',
                  methodName: 'generateAdultFemaleImage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateAdultFemaleImage()', detailString: HumanGen.generateAdultFemaleImage(),)));

                  },
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The FoodGen class',
                  methodName: 'generateNonVegImage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateNonVegImage()', detailString: FoodGen.generateNonVegImage(),)));

                  },
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: ' The FoodGen class',
                  methodName: 'generateVegetarianlmage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateVegetarianImage()', detailString: FoodGen.generateVegetarianImage(),)));

                  },
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The PlacesGen class',
                  methodName: 'generateHomeImage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateHomeImage()', detailString: PlacesGen.generateHomeImage(),)));

                  },
                ),

                CardElement(
                  textColor: Colors.amber,
                  hbloc: hbloc,
                  vbloc: vbloc,
                  categoryName: 'The PlacesGen class',
                  methodName: 'generateHotelImage()',
                  onTap: () {
                   Navigator.of(context).push(MaterialPageRoute(builder: (context) => DetailPage2( methodName: 'generateHotelImage()', detailString: PlacesGen.generateHotelImage(),)));

                  },
                ),

                Center(
                  child: Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text(
                      'Please for the foodGen methods other than images, refer the manual, due to lack of time i cannot continue to code this one application :(',
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.red),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
      // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

class DetailPage extends StatefulWidget {

  final String detailString , methodName;

  const DetailPage({Key key, @required this.detailString, @required this.methodName}) : super(key: key);
  @override
  _DetailPageState createState() => _DetailPageState();
}

class _DetailPageState extends State<DetailPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(widget.methodName,textAlign: TextAlign.center,),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Text(widget.detailString),
        ),
      ),
    );
  }
}


class DetailPage2 extends StatefulWidget {

  final String detailString , methodName;

  const DetailPage2({Key key, @required this.detailString, @required this.methodName}) : super(key: key);
  @override
  _DetailPageState2 createState() => _DetailPageState2();
}

class _DetailPageState2 extends State<DetailPage2> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text(widget.methodName,textAlign: TextAlign.center,),
      ),
      body: Center(
        child: Container(
          width: (MediaQuery.of(context).size.width/100)*90,
          height: (MediaQuery.of(context).size.height/100)*40,
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage(widget.detailString,),fit: BoxFit.contain
            )
          ),
          ),
          ),
        
      
    );
  }
}







class CardElement extends StatelessWidget {
  const CardElement(
      {Key key,
      @required this.hbloc,
      @required this.vbloc,
      @required this.categoryName,
      @required this.methodName,
      @required this.onTap,
      @required this.textColor})
      : super(key: key);

  final double hbloc;
  final double vbloc;
  final String categoryName;
  final String methodName;
  final Function onTap;
  final Color textColor;

  @override
  Widget build(BuildContext context) {
    return Card(
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
      elevation: 1.5,
      child: InkWell(
        onTap: onTap,
        child: Container(
          width: hbloc * 95,
          height: vbloc * 10,
          decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)),
          child: Column(
            children: <Widget>[
              Align(
                alignment: Alignment.centerLeft,
                child: Padding(
                  padding:
                      const EdgeInsets.only(left: 20.0, top: 20, bottom: 10),
                  child: Text(categoryName,
                      overflow: TextOverflow.ellipsis,
                      style: TextStyle(
                          color: textColor,
                          fontWeight: FontWeight.bold,
                          decoration: TextDecoration.underline)),
                ),
              ),
              Center(
                child: Text(
                  methodName,
                  textAlign: TextAlign.center,
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ultimate_data_generator: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ultimate_data_generator/ultimate_data_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on Jul 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [ultimate_data_generator] that is in a package requiring null.

Health suggestions

Format lib/lists/environment.dart.

Run flutter format to format lib/lists/environment.dart.

Format lib/lists/humandata.dart.

Run flutter format to format lib/lists/humandata.dart.

Format lib/lists/industry.dart.

Run flutter format to format lib/lists/industry.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/lists/places.dart (Run flutter format to format lib/lists/places.dart.)
  • lib/lists/socialMedia.dart (Run flutter format to format lib/lists/socialMedia.dart.)
  • lib/ultimate_data_generator.dart (Run flutter format to format lib/ultimate_data_generator.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
meta ^1.1.8 1.1.8 1.2.1
Transitive dependencies
collection 1.14.12 1.14.13
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test