flyme_generator 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

flyme_generator #

Just for Flutter.

flyme_generator is a generator for flyme (framework for flutter).

Getting Started #

Edit Config file #

  1. add flyme_annotation to pubspec.yaml:
dependencies:
  flyme_annotation:
    git:
      url: https://github.com/maybewaityou/flyme_annotation.git
  1. add flyme_generator to pubspec.yaml:
dev_dependencies:
  flyme_generator:
    git:
      url: https://github.com/maybewaityou/flyme_generator.git

Edit ViewModel file #

just see the code:

import 'package:$PROJECT_NAME$/core/provider/view_model/view_model.dart';
import 'package:flyme_annotation/flyme_annotation.dart';

import 'user.dart';

part '$VIEW_MODEL_FILE_NAME$.g.dart';

@Properties([
  Property(name: "name", type: "String", initial: ""),
  Property(name: "age", type: "num", initial: "-1"),
  Property(
      name: "user",
      type: "User",
      initial: '''User(name: "", age: -1, email: "")'''),
  Property(name: "foo", type: "String"),
  Property(name: "boo", type: "String", initial: "Welcome"),
])
class TestModel extends _ViewModelProxy {
  String test = 'Hello Test';

  @override
  void init() {
    print("==== Test init ====");
  }
}

Generate ViewModelProxy file #

run build command:

flutter packages pub run build_runner build

.g.dart file is generated after run the command.

What does the .g.dart look like #

.g.dart

// GENERATED CODE - DO NOT MODIFY BY HAND

part of '$VIEW_MODEL_FILE_NAME$.dart';

// **************************************************************************
// ViewModelGenerator
// **************************************************************************

class _ViewModelProxy extends ViewModel {
  String _name = "";
  String get name => _name;
  set name(String args) {
    _name = args;
    notifyListeners();
  }

  num _age = -1;
  num get age => _age;
  set age(num args) {
    _age = args;
    notifyListeners();
  }

  User _user = User(name: "", age: -1, email: "");
  User get user => _user;
  set user(User args) {
    _user = args;
    notifyListeners();
  }

  String _foo = null;
  String get foo => _foo;
  set foo(String args) {
    _foo = args;
    notifyListeners();
  }

  String _boo = "Welcome";
  String get boo => _boo;
  set boo(String args) {
    _boo = args;
    notifyListeners();
  }
}

[0.1.1] - first commit. #

  • first commit.

example/main.dart

void main() {}

Use this package as a library

1. Depend on it

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


dependencies:
  flyme_generator: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:flyme_generator/builder.dart';
import 'package:flyme_generator/ddd_generator.dart';
import 'package:flyme_generator/findBeginToken.dart';
import 'package:flyme_generator/function_to_widget_class.dart';
import 'package:flyme_generator/route_generator.dart';
import 'package:flyme_generator/templates/api_annotations.dart';
import 'package:flyme_generator/templates/api_generator.dart';
import 'package:flyme_generator/view_model_generator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
2
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Jul 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flyme_generator that is a package requiring null.

Package not compatible with SDK flutter

Because it is not compatible with any of the supported runtimes: flutter-native, flutter-web

Package not compatible with runtime flutter-native on Android

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/type_checker.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on Linux

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/type_checker.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on Windows

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/type_checker.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on iOS

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/type_checker.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-native on macOS

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/type_checker.dart that imports:
  • dart:mirrors

Package not compatible with runtime flutter-web on Web

Because:

  • package:flyme_generator/builder.dart that imports:
  • package:source_gen/source_gen.dart that imports:
  • package:source_gen/src/utils.dart that imports:
  • package:build/build.dart that imports:
  • package:build/src/generate/run_post_process_builder.dart that imports:
  • package:build/src/builder/post_process_builder.dart that imports:
  • package:build/src/builder/builder.dart that imports:
  • package:build/src/builder/build_step.dart that imports:
  • package:build/src/asset/reader.dart that imports:
  • package:glob/glob.dart that imports:
  • package:glob/src/list_tree.dart that imports:
  • package:glob/src/io.dart that imports:
  • package:glob/src/io_export.dart that imports:
  • dart:io

Health suggestions

Fix lib/route_generator.dart. (-0.50 points)

Analysis of lib/route_generator.dart reported 1 hint:

line 13 col 8: Don't import implementation files from another package.

Fix lib/src/functional.dart. (-0.50 points)

Analysis of lib/src/functional.dart reported 1 hint:

line 40 col 22: Avoid using braces in interpolation when not needed.

Fix lib/src/parameters.dart. (-0.50 points)

Analysis of lib/src/parameters.dart reported 1 hint:

line 86 col 72: 'type' is deprecated and shouldn't be used.

Fix lib/src/route/collector.dart. (-0.50 points)

Analysis of lib/src/route/collector.dart reported 1 hint:

line 62 col 20: Avoid using braces in interpolation when not needed.

Maintenance issues and suggestions

No valid SDK. (-20 points)

The analysis could not detect a valid SDK that can use this package.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
analyzer ^0.39.4 0.39.12
build ^1.2.2 1.3.0
build_config ^0.4.1+1 0.4.2
built_collection ^4.3.2 4.3.2
code_builder ^3.2.1 3.4.0
dart_style ^1.3.3 1.3.6
flutter 0.0.0
flyme_annotation ^0.1.0 0.1.0
mustache_template ^1.0.0+1 1.0.0+1
source_gen ^0.9.4+7 0.9.6
Transitive dependencies
_fe_analyzer_shared 5.0.0
args 1.6.0
async 2.4.2
built_value 7.1.0
charcode 1.1.3
checked_yaml 1.0.2
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
fixnum 0.10.11
glob 1.2.0
html 0.14.0+3
js 0.6.2
json_annotation 3.0.1
logging 0.11.4
matcher 0.12.8
meta 1.1.8 1.2.2
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
path 1.7.0
pedantic 1.9.0 1.9.2
pub_semver 1.4.4
pubspec_parse 0.1.5
quiver 2.1.3
sky_engine 0.0.99
source_span 1.7.0
stack_trace 1.9.5
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
watcher 0.9.7+15
yaml 2.2.1
Dev dependencies
build_runner ^1.7.2
flutter_test