dobx_gen 0.2.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 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';

@dobx
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

dependencies:
  dobx: ^0.7.0
  dobx_gen: ^0.1.0

dev_dependencies:
  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:


dependencies:
  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';
  
Version Uploaded Documentation Archive
0.2.0 Mar 30, 2017 Go to the documentation of dobx_gen 0.2.0 Download dobx_gen 0.2.0 archive
0.1.0 Mar 28, 2017 Go to the documentation of dobx_gen 0.1.0 Download dobx_gen 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
0
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 https://www.dartlang.org/dart-2#migration.

Dependencies

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