random_user 0.3.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 74

random_user Build Status Coverage Status pub package

Framework to Generate Random Users - An Unofficial Dart/Flutter SDK for https://randomuser.me

random_user is an easy to use Dart framework that provides the ability to generate random users and their accompanying data for your Dart of Flutter applications. It utilizes randomuser.me API to generate the data.

Usage #

Import the framework

import 'package:random_user/random_user.dart';

Create an instance of RandomUser class and use the getUser, getUsers or getUsersWithInfo methods. getUser will return a randomly generated user model. Use getUsers to get a list of random users. Call getUsersWithInfo to get not only a list of users, but additional Info structure which may help with pagination.

To get just a random user use:

  final api = RandomUser();
  final user = await api.getUser();

More complex sample

  final api = RandomUser();
  final users = await api.getUsers(gender: 'female', 
                                   password: 'upper,lower,number,8', 
                                   nationalities: 'NO', 
                                   results: 10);

Will return 10 female user accounts from Norway with alpha-numberical 8-symbol passwords.

License #

random_user is released under an MIT License. See LICENSE for details.

Changelog #

0.3.0 #

  • Reformat code

0.2.0 #

  • Change Dart requitement to >= 2.1.0
  • Remove unneded dependency

0.1.0 #

  • Version bump to not to scary Pub users
  • Add example
  • Code formatting

0.0.1 #

Initial Version of the library.


import 'package:random_user/random_user.dart';

main() async {
  final api = RandomUser();

  final randomUser = await api.getUser();
  print("Just a random user's email:");

  final randomList = await api.getUsers(results: 3);
  print("Three random users:");
  randomList.forEach((u) => print("${u.name.first} ${u.name.last}"));

  final knownUser = await api.getUsersWithInfo(seed: 'flutter');
  print("Always the same user:");

Use this package as a library

1. Depend on it

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

  random_user: ^0.3.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:random_user/random_user.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4

Health suggestions

Fix lib/random_user_api.dart. (-0.50 points)

Analysis of lib/random_user_api.dart reported 1 hint:

line 95 col 7: DO use curly braces for all flow control structures.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0+1 0.12.0+4
Transitive dependencies
async 2.4.0
charcode 1.1.2
collection 1.14.12
http_parser 3.1.3
meta 1.1.8
path 1.6.4
pedantic 1.9.0
source_span 1.6.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test >=0.12.42 <2.0.0
test_coverage ^0.2.0