Search packages, repositories and app categories

Package detailsv5.2.3

reflectable

Reflection support based on code generation, using 'capabilities' to specify which operations to support, on which objects. This is the run-time part of reflectable.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
16.5K
Likes
188
Pub points
160

Install package

flutter pub add reflectable

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Reflectable provides reflection capabilities in Dart through code generation, enabling runtime inspection and manipulation of types, fields, methods, and constructors. Instead of relying on built-in reflection (which is limited in Flutter), it uses 'capabilities' to define exactly which reflective operations are supported for specific classes. This approach ensures performance and compatibility across platforms like Android, iOS, Web, macOS, Windows, and Linux. It's ideal for frameworks and libraries needing dynamic behavior without sacrificing tree-shaking or performance.

Use cases

  • Dynamic serialization/deserialization
  • Runtime type inspection
  • Generic framework development
  • Code generation for APIs
  • Plugin and library extensibility

Key features

  • Code-generated reflection
  • Capability-based operation control
  • Cross-platform support
  • Minimal runtime overhead
  • Integration with build_runner
  • Supports fields, methods, and constructors

Suitable for

  • Framework developers
  • Library authors
  • Tools requiring dynamic type handling
  • Apps using code generation
  • Performance-sensitive applications

Considerations

  • Requires build_runner and code generation
  • Limited to explicitly declared capabilities
  • Not suitable for runtime-only reflection
  • Needs careful setup of reflectable annotations
  • May increase build time slightly

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

This repository provides the Dart packages reflectable and reflectable_builder, along with a set of test cases and examples in the repository test_reflectable.

reflectable

Support for implementing a large subset of the features offered by 'dart:mirrors' without relying on 'dart:mirrors' itself. Provides a system based on capabilities to control the amount of reflection support.

reflectable_builder

Support for generating the code that the package reflectable uses to provide the reflection support described above.

test_reflectable

Used to test package reflectable. Also serves as a set of examples of how reflectable can be used.

Categories

Source repository

Projects using this package