activatory 0.0.7

  • Example
  • Installing
  • Versions
  • 57

Activatory #

Build Status Pub

This project is aimed to bring a test data generator to Dart's ecosystem. This will greatly simplify unit testing and especially Test-Driven Development.

This project is inspired by .NET Autofixture library.

This is my first Dart project. Actually, this is my "pet-project" so there are no exact plans and etc.

Project TODO's: #

  • [x] Add primitive types support
  • [x] Add complex types support
    • [x] using constructor
    • [x] using factory methods
    • [x] using named constructors
    • [x] using default argument values for positional arguments
    • [x] using named arguments
    • [x] using default argument values for named arguments
  • [ ] Customization of complex object factory strategy selection: random/round robin/first/shortest/longest
  • [x] Add ability to explicit register factory
  • [x] Add fixed (singleton) values support
  • [ ] Add parameter overloading by name
  • [ ] Add parameter overloading by type
  • [ ] Add configuration layers and reusability for complex cases
  • [ ] Add paramsObject and paramsObject to factory matching
  • [ ] Add ability to customize context before data generation without saving settings to context
  • [ ] Add paramsObject layering
  • [ ] *Read autofixture sources to gather ideas and vision
  • [ ] *Add examples and docs
  • [ ] *Add CI/CD:
    • [ ] *build and publish to pub
    • [ ] *coverage reports
  • [ ] Add nice looking readme and github repo info
  • [ ] Add recursion handling (which one strategy should be used?)
  • [ ] Encapsulate all errors inside library (throws only ActivatoryException)
  • [ ] Add feature customization (e.g. ctor resolution strategy, default values handling and etc)

v0.0.1-0.0.4 #

  • Added support for primitive objects activation: int, double, String, bool, DateTime
  • Added support for complex object activation by calling ctors, named ctors, factories and using positional arguments

v0.0.5 #

  • Named arguments supported
  • Complex object activation now respects default non null values

v0.0.6 #

  • Added ability to register factory explicitly

v0.0.7 #

  • Added ability to register generated singleton
  • Added ability to register pre defined value


import 'package:activatory/src/activatory.dart';

main() {
  var activatory = new Activatory();

  // We can create primitive types
  print('Int: ${activatory.getTyped<int>()}');
  print('String: ${activatory.getTyped<String>()}');
  print('DateTime: ${activatory.getTyped<DateTime>()}');
  print('Bool: ${activatory.getTyped<bool>()}');

  //We can create complex types
  var complexClassInstance = activatory.getTyped<SomeComplexClass>();
  print('Complex.String: ${complexClassInstance.stringField}');

  //And yes, we can create them recursively
  var moreComplexClassInstance = activatory.getTyped<MoreComplexClass>();
  print('MoreComplex.DateTime: ${moreComplexClassInstance.dateTimeField}');
  print('MoreComplex.Complex.String: ${moreComplexClassInstance.someComplexClass.stringField}');

class SomeComplexClass{
  String _stringField;
  String get stringField => _stringField;


class MoreComplexClass{
  DateTime _dateTimeField;
  DateTime get dateTimeField => _dateTimeField;

  SomeComplexClass _someComplexField;
  SomeComplexClass get someComplexClass => _someComplexField;

  MoreComplexClass(this._dateTimeField, this._someComplexField);

Use this package as a library

1. Depend on it

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

  activatory: ^0.0.7

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:activatory/activatory.dart';
Version Uploaded Documentation Archive
0.0.20 Mar 3, 2019 Go to the documentation of activatory 0.0.20 Download activatory 0.0.20 archive
0.0.19 Feb 17, 2019 Go to the documentation of activatory 0.0.19 Download activatory 0.0.19 archive
0.0.18 Feb 16, 2019 Go to the documentation of activatory 0.0.18 Download activatory 0.0.18 archive
0.0.17 Feb 10, 2019 Go to the documentation of activatory 0.0.17 Download activatory 0.0.17 archive
0.0.16 Jan 19, 2019 Go to the documentation of activatory 0.0.16 Download activatory 0.0.16 archive
0.0.15 Jan 19, 2019 Go to the documentation of activatory 0.0.15 Download activatory 0.0.15 archive
0.0.14 Jan 17, 2019 Go to the documentation of activatory 0.0.14 Download activatory 0.0.14 archive
0.0.13 Jan 13, 2019 Go to the documentation of activatory 0.0.13 Download activatory 0.0.13 archive
0.0.12 Jan 12, 2019 Go to the documentation of activatory 0.0.12 Download activatory 0.0.12 archive
0.0.11 Jan 7, 2019 Go to the documentation of activatory 0.0.11 Download activatory 0.0.11 archive

All 20 versions...

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 May 8, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15


Detected platforms: web, other

Primary library: package:activatory/activatory.dart with components: mirrors.

Health suggestions

Format lib/activatory.dart.

Run dartfmt to format lib/activatory.dart.

Format lib/src/activation_context.dart.

Run dartfmt to format lib/src/activation_context.dart.

Format lib/src/activatory.dart.

Run dartfmt to format lib/src/activatory.dart.

Format lib/src/backends/explicit_backend.dart.

Run dartfmt to format lib/src/backends/explicit_backend.dart.

Format lib/src/backends/singleton_backend.dart.

Run dartfmt to format lib/src/backends/singleton_backend.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
uuid ^2.0.0-rc1 2.0.1
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
typed_data 1.1.6
Dev dependencies
test ^1.0.0