copyable_plus 1.0.1 copy "copyable_plus: ^1.0.1" to clipboard
copyable_plus: ^1.0.1 copied to clipboard

A Dart annotation and code generator that creates `copyWith`, `toJson`, and `fromJson` methods for your immutable classes.

📦 copyable_plus #

A Dart annotation and code generator that creates copyWith, toJson, and fromJson methods for your immutable classes.


Pub Version Dart License


✨ Features #

✅ Generates copyWith()
✅ Supports toJson() and fromJson()
✅ Works with nested models and lists
✅ Null-safe
✅ Lightweight and easy to use


🚀 Getting Started #

1️⃣ Add Dependencies #

dependencies:
  copyable_plus: ^0.1.0

dev_dependencies:
  build_runner: ^2.4.6
  source_gen: ^2.0.0

2️⃣ Annotate Your Class

import 'package:copyable_plus/copyable_plus.dart';

part 'person.copyable.dart';

@Copyable()
class Person {
  final String name;
  final int age;

  Person({required this.name, required this.age});
}

3️⃣ Generate Code Run this in your terminal:

dart run build_runner build

This will generate a *.copyable.dart file with:

copyWith() method

toJson() method

fromJson() static constructor

1
likes
130
points
120
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart annotation and code generator that creates `copyWith`, `toJson`, and `fromJson` methods for your immutable classes.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

analyzer, build, meta, source_gen

More

Packages that depend on copyable_plus