schemantic 0.0.1-dev.2 copy "schemantic: ^0.0.1-dev.2" to clipboard
schemantic: ^0.0.1-dev.2 copied to clipboard

A builder for generating Genkit schema extension types.

Schemantic #

A builder for generating Genkit schema extension types.

Installation #

dev_dependencies:
  schemantic: any
  build_runner: ^2.8.0

Usage #

Annotate your schemas with @Schematic() and run dart run build_runner build.

import 'package:genkit/genkit.dart';

part 'my_schema.g.dart';

@Schematic()
abstract class MyInput {
  String get name;
  int? get age;
}

void main() {
  // Use the generated data class
  final input = MyInput.from(name: 'Alice', age: 30);
  print(input.name); // Alice
  
  // Serialize to JSON
  final json = input.toJson();
  print(json); // {name: Alice, age: 30}
  
  // Parse from JSON using the generated Type class
  final parsed = MyInputType.parse(json);
  print(parsed.name); // Alice
}
0
likes
0
points
0
downloads

Publisher

verified publishergenkit.dev

Weekly Downloads

A builder for generating Genkit schema extension types.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, build, code_builder, dart_style, json_schema_builder, source_gen

More

Packages that depend on schemantic