got_it 1.1.1+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 0

got_it #

get_it is so simple, this was made in 15 minutes from nothing but get_it's readme.

Why? #

Partially because experiments, partially because boredom, partially because practice.

Compared to get_it, you get:

get_it (the good one)got_it (this one)
You shouldn't use itX
SupportX
Competent dev teamX
CommentsXX
It's just a fancy mapXX
Supports being an instanceXX
Supports being a singletonXX
Supports singletonsXX
Supports lazy singletonsXX
Supports buildersXX
Supports named instancesType or StringType and String
Anti-Replacement granularityCoarseFine (Per Type)
Error handlingExceptionCustom Error
Length w/o comments100 lines97 lines

1.1.1 - Internal fixes #

  • Better hashcode calculation for entries
  • Add instance name to errors

1.1.0 - Multiple instances of the same type #

  • Can now support multiple instances of the exact same type using instance names.

1.0.0 - Initial Release #

Changes from get_it

  • added per-type reassignment restrictions
  • added an optional singleton
  • Use custom errors instead of Exception
  • More documentation

example/main.dart

import 'package:got_it/got_it.dart';

final gotIt = GotIt();

void main() {
  const name = "This is the got_it package!";
  gotIt.registerSingleton<String>(name);
  sayMyName();
}

void sayMyName() {
  print(gotIt<String>());
}

Use this package as a library

1. Depend on it

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


dependencies:
  got_it: ^1.1.1+2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


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

This package is not analyzed, because it is discontinued.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0