Skip to content

copydog/lombok.dart

Repository files navigation

Lombok (Dart Version)

Reference

lombok (Java)

Feature

  • @data / @Data()

    • full configuration
    • toString
    • @EqualAndHashCode
  • @getter / @Getter()

    • full configuration
    • support use on field
  • @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;
  }
}

About

The dart version of Lombok

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages