lombok 0.0.5

Lombok (Dart Version) #

Reference #

lombok (Java)

Feature #

  • [x] @data / @Data()

    • [ ] full configuration
    • [ ] toString
    • [ ] @EqualAndHashCode
  • [x] @getter / @Getter()

    • [ ] full configuration
    • [ ] support use on field
  • [x] @setter / @Getter()

    • [ ] full configuration
    • [ ] support use on field
  • [ ] @equalsAndHashCode / @EqualsAndHashCode()

    • [ ] full configuration
  • [ ] @toString / @ToString()

    • [ ] full configuration
  • [ ] Other

    • [ ] @NonNull
    • [ ] @Cleanup
    • [ ] @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor
    • [ ] @Value
    • [ ] @Builder
    • [ ] @SneakyThrows
    • [ ] @Synchronized
    • [ ] @Log
    • [ ] experimental
    • [ ] etc.

Usage #

A simple usage example:

// file: some_class.dart

part 'some_class.g.dart';

@data
class SomeClass with _$SomeClassLombok {
  int counter = 1;
}

// Equal to
class SomeClass {
  int counter = 1;
  
  int getCounter() {
    return counter;
  }
  
  void setCounter(int counter) {
    this.counter = counter;
  }
}

0.0.4 #

  • Support generic type
  • Considering generate setter for private field

0.0.3 #

  • Fix getter template
  • Update readme
  • Clean up useless code

0.0.2 #

  • Fix wrong dependency configuration

0.0.1 #

  • Initial version, created by Stagehand
  • Finish basic usage of @data, @setter and @getter
  • Support @setter and @getter use on field with @lombokt

example/lombok_example.dart

import 'package:lombok/lombok.dart';
import 'package:mobx/mobx.dart';

part 'lombok_example.g.dart';

@setter
class SetterExample with _$SetterExampleLombok {
  int a = 1;
  String b = '2';
  List<int> c = [3, 4, 5];
  bool _d = false;

  @observable
  int f = 6;
}

Use this package as a library

1. Depend on it

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


dependencies:
  lombok: ^0.0.5

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:lombok/lombok.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
40
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Aug 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:lombok/lombok.dart.

Health suggestions

Fix lib/src/util/serializer.dart. (-1.49 points)

Analysis of lib/src/util/serializer.dart reported 3 hints:

line 5 col 8: The value of the field '_useToString' isn't used.

line 7 col 31: The value of the field '_setterFieldList' isn't used.

line 9 col 22: The value of the field '_getterFieldList' isn't used.

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

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

line 16 col 14: The value of the local variable 'className' isn't used.

Fix lib/src/template/to_string_template.dart. (-0.50 points)

Analysis of lib/src/template/to_string_template.dart reported 1 hint:

line 9 col 7: The top level variable '_field_template' isn't used.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/collector/data_collector.dart (Run dartfmt to format lib/src/collector/data_collector.dart.)
  • lib/src/collector/lombok_collector.dart (Run dartfmt to format lib/src/collector/lombok_collector.dart.)
  • lib/src/collector/setter_collector.dart (Run dartfmt to format lib/src/collector/setter_collector.dart.)
  • lib/src/generator.dart (Run dartfmt to format lib/src/generator.dart.)
  • lib/src/util/field_util.dart (Run dartfmt to format lib/src/util/field_util.dart.)
  • lib/src/util/template_util.dart (Run dartfmt to format lib/src/util/template_util.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (analyzer, mobx).

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 5 dependencies without version constraints. Specify version ranges for the following dependencies: analyzer, build, mobx, mustache4dart, source_gen.

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.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer any 0.37.1+1 0.38.0
build any 1.1.6
mobx any 0.3.5+1 0.3.6-alpha
mustache4dart any 3.0.0-dev.1.0
source_gen >=0.8.0 0.9.4+3
Transitive dependencies
args 1.5.2
async 2.3.0
build_daemon 2.0.0
build_resolvers 1.0.7
build_runner_core 3.0.9
built_collection 4.2.2
built_value 6.7.0
charcode 1.1.2
checked_yaml 1.0.2
code_builder 3.2.0
collection 1.14.12
convert 2.1.1
crypto 2.1.1+1
csslib 0.16.1
dart_style 1.2.9
fixnum 0.10.9
front_end 0.1.21+1 0.1.22
glob 1.1.7
graphs 0.2.0
html 0.14.0+2
http 0.12.0+2
http_multi_server 2.1.0
http_parser 3.1.3
io 0.3.3
js 0.6.1+1
json_annotation 3.0.0
kernel 0.3.21+1 0.3.22
logging 0.11.3+2
matcher 0.12.5
meta 1.1.7
mime 0.9.6+3
package_config 1.1.0
package_resolver 1.0.10
path 1.6.4
pedantic 1.8.0+1
pool 1.4.0
pub_semver 1.4.2
pubspec_parse 0.1.5
quiver 2.0.5
reflectable 2.1.0
shelf 0.7.5
shelf_web_socket 0.2.3
source_span 1.5.5
stack_trace 1.9.3
stream_channel 2.0.0
stream_transform 0.0.19
string_scanner 1.0.5
term_glyph 1.1.0
timing 0.1.1+2
typed_data 1.1.6
watcher 0.9.7+12
web_socket_channel 1.0.15
yaml 2.1.16
Dev dependencies
build_config >=0.3.0 0.4.1+1
build_runner >=0.9.1 1.6.6
test any