dobx_gen 0.2.0

dobx_gen #

Generate dobx observables via source_gen

Example #

lib/todo.dart #

library hello;

import 'package:dobx/dobx.dart';
import 'package:dobx_gen/core.dart';

part 'hello.g.dart';

abstract class Todo {

  String title;
  bool completed;

  factory Todo() => _$Todo( // this method is generated
    title: 'hello, world!',
    completed: false,

pubspec.yaml #

name: hello
description: dobx_gen example
version: 0.1.0

  dobx: ^0.7.0
  dobx_gen: ^0.1.0

  build_runner: ^0.3.0+1

tool/build.dart #

import 'dart:async';

import 'package:build_runner/build_runner.dart';
import 'package:dobx_gen/core_gen.dart';
import 'package:source_gen/source_gen.dart';

Future main(List<String> args) async {
  await build(
      new PhaseGroup.singleAction(
          new GeneratorBuilder([new DobxGenerator()]),
          new InputSet('hello', const ['lib/*.dart'])),
      deleteFilesByDefault: true);

Generated code #

dart tool/build.dart

0.2.0 #

  • Ignore static fields

0.1.0 #

  • Generate observable fields (string/int/bool) from a class annotated with @dobx

Use this package as a library

1. Depend on it

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

  dobx_gen: ^0.2.0

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:dobx_gen/core.dart';
import 'package:dobx_gen/core_gen.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.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see

Maintenance issues and suggestions

Make sure dartdoc successfully runs on your package's source files. (-10 points)

Dependencies were not resolved.


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