random_user 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new73

random_user Build Status Coverage Status

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.1.0 #

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

0.0.1 #

Initial Version of the library.

example/example.dart

import 'package:random_user/random_user.dart';

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

  final randomUser = await api.getUser();
  print("Just a random user's email:");
  print(randomUser.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:");
  print(knownUser.results.first.login.username);
}

Use this package as a library

1. Depend on it

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


dependencies:
  random_user: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.1.0 Jan 22, 2019 Go to the documentation of random_user 0.1.0 Download random_user 0.1.0 archive
0.0.1 Jan 22, 2019 Go to the documentation of random_user 0.0.1 Download random_user 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
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 Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:random_user/random_user.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
http ^0.12.0+1 0.12.0+1
meta ^1.1.6 1.1.7
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
path 1.6.2
source_span 1.5.4
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
test >=0.12.42 <2.0.0
test_coverage ^0.2.0