fasq_serializer_generator 0.1.1+3 copy "fasq_serializer_generator: ^0.1.1+3" to clipboard
fasq_serializer_generator: ^0.1.1+3 copied to clipboard

Build runner generator for automatically registering serializers from TypedQueryKey declarations

fasq_serializer_generator #

Code generator for FASQ (Flutter Async State Query).

Automatically registers serializers from your TypedQueryKey declarations, eliminating boilerplate code for complex data types.

Current Version: 0.1.1

📚 Documentation #

For full documentation and API reference, visit:
https://fasq.shafi.dev/core/type-safety

✨ Features #

  • 🤖 Automatic Detection: Scans for TypedQueryKey<T> in your QueryKeys classes.
  • 📦 Serializer Registration: Generates registration code for fromJson/toJson.
  • 🏗️ Build Runner: Integrates seamlessly with build_runner.

📦 Installation #

dev_dependencies:
  fasq_serializer_generator: ^0.1.1
  build_runner: ^2.4.0

🚀 Usage #

1. Annotate Keys #

Add @AutoRegisterSerializers() to your keys class.

import 'package:fasq/fasq.dart';
import 'package:fasq_serializer_generator/fasq_serializer_generator.dart';

@AutoRegisterSerializers()
class QueryKeys {
  static const products = TypedQueryKey<List<Product>>('products', List<Product>);
  static const user = TypedQueryKey<User>('user', User);
}

2. Run Builder #

dart run build_runner build

3. Register #

Use the generated registerQueryKeySerializers function.

import 'query_keys.serializers.g.dart';

void main() {
  // Pass the registry to register helper
  final registry = registerQueryKeySerializers(CacheDataCodecRegistry());
  
  // Use registry in your client
  final client = QueryClient(
    config: CacheConfig(codecRegistry: registry),
  );
}

📄 License #

MIT

0
likes
40
points
72
downloads

Publisher

verified publishershafi.dev

Weekly Downloads

Build runner generator for automatically registering serializers from TypedQueryKey declarations

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

analyzer, build, fasq, path, source_gen

More

Packages that depend on fasq_serializer_generator