credentials_helper 1.0.3

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

credentials_helper

The idea behind this package is to provide a simple way to use various credentials in a project (particularly during development/testing) that is less prone to result in a private API key or the like being commited or published along with your code.

You can store your API keys, usernames, passwords, etc. in a JSON file that is either listed in your .gitignore or completely outside the project directory and load them into this class. You could also retrieve them from other JSON sources.

Example

credentials.json

{
  "api_key": "YOUR-API-KEY",
  "username": "yourUsername",
  "password": "yourPassword"
}

Dart code

import 'package:credentials_helper/credentials_helper.dart';

void main() {

  Credentials credentials = Credentials.fromFile('credentials.json');

  myApiCall(apiKey: credentials.apiKey);

}

v1.0.3 - 2018-07-26

  • Updated to support Dart 2

v1.0.2 - 2018-07-25

  • Updated to use json_serializable v1.0.0

v1.0.1 - 2018-07-14

  • Changed Credentials class serializer to use "api_key" as the key name even though the property name is "apiKey"
  • Added JSON example to README

v1.0.0 - 2018-07-13

  • Initial release.

example/example.dart

import 'package:credentials_helper/credentials_helper.dart';

void main() {

  Credentials credentials = Credentials.fromFile('credentials.json');

  myApiCall(apiKey: credentials.apiKey);

}

Use this package as a library

1. Depend on it

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


dependencies:
  credentials_helper: ^1.0.3

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:credentials_helper/credentials_helper.dart';
  
Version Uploaded Documentation Archive
1.0.3 Jul 26, 2018 Go to the documentation of credentials_helper 1.0.3 Download credentials_helper 1.0.3 archive
1.0.2 Jul 26, 2018 Go to the documentation of credentials_helper 1.0.2 Download credentials_helper 1.0.2 archive
1.0.1 Jul 14, 2018 Go to the documentation of credentials_helper 1.0.1 Download credentials_helper 1.0.1 archive
1.0.0 Jul 14, 2018 Go to the documentation of credentials_helper 1.0.0 Download credentials_helper 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
36
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]
68
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3

Platforms

Detected platforms: Flutter, other

Primary library: package:credentials_helper/credentials_helper.dart with components: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
json_annotation ^1.0.0 1.1.0
Dev dependencies
build_runner ^0.9.2
json_serializable ^1.0.0
test ^1.3.0