katana_value 3.0.0-dev.1 copy "katana_value: ^3.0.0-dev.1" to clipboard
katana_value: ^3.0.0-dev.1 copied to clipboard

This is a macro package for creating immutable data classes. It can be applied to widgets in addition to regular data.

example/lib/main.dart

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:katana_value/katana_value.dart';

@DataValue()
class Person {
  final String name;
  final String text;
}

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: "Flutter Demo",
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
    );
  }
}

class ValuePage extends StatefulWidget {
  const ValuePage({super.key});

  @override
  State<StatefulWidget> createState() => _ValuePageState();
}

class _ValuePageState extends State<ValuePage> {
  final person = Person(name: "aaa", text: "aaa");

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Value Page"),
      ),
      body: Center(
        child: Text(person.toJson().toString()),
      ),
    );
  }
}
0
likes
140
points
36
downloads

Publisher

verified publishermathru.net

Weekly Downloads

This is a macro package for creating immutable data classes. It can be applied to widgets in addition to regular data.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, katana, katana_macro, macros

More

Packages that depend on katana_value