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.
5.2.3
13K downloads/mo
#2583 most downloaded on pub.dev
google/reflectable.dart
What this package is like to depend on
Last release 3 months ago
26 May 2026
Release timing varies
gaps range from 8 days to 13 months
Nearly every release is documented
notes for 86 of 86 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
89 releases · first in 2015
9 releases in the last 12 months
see the full history below
Release timeline
89 releases · Jul 2015 to May 2026Releases
latest 60 of 89-
5.2.326 May 2026 -
5.2.219 May 2026 -
5.2.110 Feb 2026 -
5.2.002 Feb 2026 -
5.1.009 Dec 2025Release notes
Open source →- Upgrade reflectable to use version ^8.0.0 of the analyzer and version ^4.0.0 of build.
-
5.0.102 Oct 2025Release notes
Open source →- Add an example that does not rely on code generation, basically just
a recommendation to look at
reflectable_builderfor a real example.
- Add an example that does not rely on code generation, basically just
a recommendation to look at
-
5.0.029 Sep 2025Release notes
Open source →- Breaking change: Split the code generator off of the package
reflectable. This code generator must henceforth be obtained from the packagereflectable_builder. The point is that this can be adev_dependency. This also implies thatbuild.yamlmust specify the reflectable code generator asreflectable_builder:rather than justreflectable:.
- Breaking change: Split the code generator off of the package
-
4.0.1504 Sep 2025Release notes
Open source →- Use language version 3.9. In particular, use the 3.9 style of formatting.
-
4.0.1429 Aug 2025Release notes
Open source →- Use language version 3.7.
- Migrate reflectable to use analyzer version ^7.0.0 (which removes
the dependency on
_macros, which doesn't exist any more). - This includes a small part of the migration work needed in order
to use the new element model in the analyzer (
Element2, for now). - Lots of reformatting (creates a big diff).
-
4.0.1328 May 2025Release notes
Open source →- Use language version 3.6.
- Use newer versions of
build_runner_core(^8.0.0) anddart_style(^3.0.0), to enable the new formatting style. - Ignore deprecated member use because
build_runneris not yet ready for the newElementmodel. - Add support for suppression of warnings via environment variables.
The environment variable has prefix
REFLECTABLE_SUPPRESS_...and thenUPPER_CASEof theWarningKind. For example,export REFLECTABLE_SUPPRESS_BAD_METADATA=yeswill suppress thebadMetadatawarning. - Reformat the implementation to use the new style.
- Introduce support for specifying the language version used by the
formatter by setting
REFLECTABLE_FORMATTER_LANGUAGE_VERSIONto a value of the form[0-9]+\\.[0-9]+. - Added information to the design document in
docabout the supported environment variables.
-
4.0.1223 Oct 2024Release notes
Open source →- Revert analyzer dependency to 6.8.0 and lints to 5.0.0 due to macro related version resolution conflict. Undo some changes that are required for analyzer 6.11.0, but which are errors with 6.8.0.
-
4.0.1122 Oct 2024Release notes
Open source →- Fix bug 291 (such that metadata on enum values can be obtained).
- Update dependencies to use analyzer 6.11.0 and lints 5.1.0.
- Change the implementation to use
..._obvious_local_variable_typeslints. - Update the [capability design document][1] slightly.
-
4.0.1022 Aug 2024 -
4.0.905 Jul 2024Release notes
Open source →- Lower the upper bound for the analyzer to avoid a complaint that we should import a library that doesn't exist with the analyzer when using the lower bound. Import the older library that does exist.
-
4.0.805 Jul 2024Release notes
Open source →- Downgrade analyzer to 6.5.0, to avoid version conflict involving
macrosand_macros(that we can't do anything about from here).
- Downgrade analyzer to 6.5.0, to avoid version conflict involving
-
4.0.705 Jul 2024 -
4.0.607 Mar 2024 -
4.0.513 Feb 2023Release notes
Open source →-
Remove legacy tests (they cannot be executed when using a version of Dart which will be released soon).
-
Use an upper bound of 4.0.0 for the SDK constraint, preparing for said release.
-
Change the computation of the Uri of a library mirror such that it is taken from the
AssetIdof the library, when possible. This should be helpful in situations where the Uri is used to find the actual file. This is technically a breaking change, but we do not consider it to be a breaking change in practice, because the Uri's provided in previous versions were essentially meaningless strings. They were just known to be distinct for distinct libraries, and that property also holds with this change.For documentation about how these URIs are generated, please see https://pub.dev/documentation/build/latest/build/AssetId/uri.html and https://pub.dev/documentation/build/latest/build/AssetId-class.html .
For documentation about package URIs, please see
https://api.dart.dev/stable/2.19.2/dart-isolate/Isolate/packageConfig.htmland, for example,https://pub.dev/packages/package_config.
-
-
4.0.408 Dec 2022Release notes
Open source →- Resolve bug #300. Expressions of the form
f<T>denoting a generic instantiation of a function (that is: the result of passing the type argumentTto the generic functionf, yielding a non-generic function) was not supported; this version supports it.
- Resolve bug #300. Expressions of the form
-
4.0.305 Dec 2022Release notes
Open source →- Change code generation such that null safe programs do not give rise
to a language version comment in the generated code. Previously, such
programs would have
// @dart = 2.12in the generated library, but this causes newer features to be unavailable in the generated code. As before, programs which are not fully null safe will have a generated library that contains// @dart = 2.9.
- Change code generation such that null safe programs do not give rise
to a language version comment in the generated code. Previously, such
programs would have
-
4.0.202 Nov 2022Release notes
Open source →- Change handling of 'dart:...' libraries, to handle new behavior by
build_resolvers2.1.0: 'dart:html' wasn't reported before byresolver.libraries, but is now included. To preserve existing behavior (and avoid generating code that imports 'dart:html'), this update removes 'dart:html' from the set of libraries that are considered "importable" by generated code.
- Change handling of 'dart:...' libraries, to handle new behavior by
-
4.0.126 Oct 2022Release notes
Open source →- Update reflectable to use (and require) analyzer 5.2.0. This is a substantial update, because several analyzer members in the analyzer have been deprecated.
-
4.0.016 Sep 2022Release notes
Open source →- Update reflectable to use (and require) analyzer 5.0.0. This is a substantial update, because several analyzer members in the analyzer have been deprecated, and some replacements have different return types.
- Breaking change: The analyzer now reports that the 'mixin' of a
'mixin application class' (e.g.,
class B = A with M1, M2;) is the class itself (i.e.,B), and the last mixin (M2) is obtained asmirror.superclass.mixin. Previously the same mixin would be obtained withmirror.mixin. This is actually a more faithful model than the one used previously, so the new behavior is also used by reflectable. (In particular, if we haveclass B2 = A with M1, M2;thenB == B2is not true, which implies that the mixin application class works like a regular class declaration with an empty body, e.g.,class B = A with M1, M2;works likeclass B extends A with M1, M2 {}, wheremirror.superclass.mixinis the natural way to obtain a mirror ofM2). This is a breaking change, but it only affects usages where there is a dependency on the exact superclass structure, and it seems likely that this only happens rarely: we may well traverse all supertypes or all superclasses, but we are not likely to do things like "go to the 5th superclass, find the mixin, and check that it has afoomethod".
-
3.0.1015 Sep 2022 -
3.0.908 Jul 2022Release notes
Open source →- Add support for checking whether a
TypeMirroris reflecting on a nullable or non-nullable type. - Update dependencies to use analyzer ^4.2.0, lints ^2.0.0.
- Add support for checking whether a
-
3.0.817 Mar 2022Release notes
Open source →- Correct bug reported as #267 (
nullwas generated in a case where the expression had to have typeint). - Change code generation such that no invocations of generative constructors of enums are generated (such that it works with 'enhanced-enums').
- Correct bug reported as #267 (
-
3.0.722 Feb 2022Release notes
Open source →- Change
analysis_options.yamlsuch that we get the same linting locally and on pub.dev. Update many libraries and tests to conform to the currently recommended lints.
- Change
-
3.0.618 Feb 2022Release notes
Open source →- Update reflectable to require analyzer ^3.2.0; adjust several locations in the code where null is handled, but analyzer methods will now return a non-null value. Optimize several capability related getters by caching the result.
-
3.0.519 Jan 2022Release notes
Open source →- Update reflectable to require analyzer ^3.0.0 (currently using 3.1.0),
and to replace the package
pedanticby the packagelints.
- Update reflectable to require analyzer ^3.0.0 (currently using 3.1.0),
and to replace the package
-
3.0.417 Aug 2021 -
3.0.329 Jul 2021 -
3.0.206 May 2021Release notes
Open source →- Migrate the code generator. The reflectable package is hereby fully migrated to null safety.
- Update the following dependencies:
build_config^1.0.0,build_runner: ^2.0.1,build_runner_core: ^7.0.0.
-
3.0.122 Mar 2021 -
3.0.016 Mar 2021Release notes
Open source →- Support null safety in a stable version of reflectable.
- Change minimum SDK constraint to 2.12.0.
- Use
analyzer^1.1.0;build^2.0.0;build_resolvers^2.0.0;glob^2.0.0;logging^1.0.0;package_config^2.0.0. - Bug fix: Handle types of the form
T*in some extra cases.
-
3.0.0-nullsafety.121 Jan 2021 pre-releaseRelease notes
Open source →- Enable analyzer version 0.41.2.
- Change code generation to use new
Resolver.astNodeFormethod, eliminating theInconsistentAnalysisExceptionworkaround in most cases. - Prevent unnecessary code generation for inputs named
*.vm_test.*,*.node_test.*, or*.browser_test.*, to reduce code generation time.
-
3.0.0-nullsafety.020 Jan 2021 pre-releaseRelease notes
Open source →- Migrate the generated code and its dependencies to null safety.
- Remove
bestEffortReflectedType,hasBestEffortReflectedType, deprecated since version 0.5.0. - Change the return type of
ObjectMirror.delegatefromdynamictoObject?, for consistency with several methods namedinvoke....
-
2.2.903 Dec 2020Release notes
Open source →- Change
build.yamlto ensure that 'lib/main.dart' will again be considered an entry point for code generation. - Update dependencies to include analyzer 0.40.5, 0.40.6, 0.41.0, 0.41.1.
- Re-fixing issue #198, cf.
google/built_value.dartissue #941.
- Change
-
2.2.808 Oct 2020Release notes
Open source →- Update dependencies to include analyzer 0.40.4, with 0.40.3 as lower bound because of a breaking change.
-
2.2.707 Oct 2020 -
2.2.628 Sep 2020Release notes
Open source →- Resolve #198 (InconsistentAnalysisException), based on workaround from dart-lang/build#2634. Also widen the analyzer version constraint to include all 0.39 versions published at this point.
-
2.2.516 Jun 2020Release notes
Open source →- Update dependencies. In particular, analyzer can now be 0.39.10.
Handle issue with
sync*functions, cf. issue #210.
- Update dependencies. In particular, analyzer can now be 0.39.10.
Handle issue with
-
2.2.427 Mar 2020 -
2.2.316 Mar 2020 -
2.2.216 Mar 2020 -
2.2.120 Dec 2019Release notes
Open source →- Fix a bug concerned with the ordering of named parameters in a constructor declaration.
- Update reflectable to use package analyzer version
<0.40.0. - Ensure that generated code is lint free with package pedantic 1.9.0.
- Make reflectable itself lint free with package pedantic 1.9.0.
-
2.2.1+114 Jan 2020Release notes
Open source →- Restricting analyzer version to <= 0.39.3, because 0.39.3 contains a breaking change in the parameter list of a constructor.
-
2.2.1+221 Jan 2020 -
2.2.022 Oct 2019Release notes
Open source →- Adjust implementation to satisfy 'pedantic' lints. The generated code
does this as well, except that some
constmodifiers are generated even though they could be omitted (an// ignore_for_filecomment is generated such that the linter does not complain about this). Upgrade dependencies to allow using analyzer 0.38.5, and current versions of many other packages.
- Adjust implementation to satisfy 'pedantic' lints. The generated code
does this as well, except that some
-
2.1.026 Jul 2019Release notes
Open source →- Code generator rewritten in order to work with changes in the analyzer
APIs, enabling the use of analyzer version 0.37.0 (and newer versions of
many other packages), which addresses issue #173. See issue #180 about
missing support for two features: This affects code in platform libraries
(that is, libraries imported with 'dart:...' except 'dart:ui'). If a
declaration in a platform library has metadata, a query for this metadata
using
DeclarationMirror.metadatawill return null. Also, if a constructor in a platform library has a parameter with a default value, and that parameter is omitted in a reflective invocation, the value passed will benullrather than the declared value. This is a bug, but it is blocked on getting access to AST nodes in platform libraries from the resolver provided by build.
- Code generator rewritten in order to work with changes in the analyzer
APIs, enabling the use of analyzer version 0.37.0 (and newer versions of
many other packages), which addresses issue #173. See issue #180 about
missing support for two features: This affects code in platform libraries
(that is, libraries imported with 'dart:...' except 'dart:ui'). If a
declaration in a platform library has metadata, a query for this metadata
using
-
2.0.1210 May 2019Release notes
Open source →- Follow-up bug fix related to #170: Corrected
ParameterMirror.defaultValuefor initializing formals.
- Follow-up bug fix related to #170: Corrected
-
2.0.1103 May 2019Release notes
Open source →- Bug fix #170: Default values for initializing formals are now included
when generating function literals for
newInstance.
- Bug fix #170: Default values for initializing formals are now included
when generating function literals for
-
2.0.1015 Feb 2019 -
2.0.10+126 Feb 2019 -
2.0.914 Jan 2019 -
2.0.830 Oct 2018Release notes
Open source →- Fix version conflict #153: Updated version constraints on analyzer, build, build_runner, and test. Ported reflectable_builder.dart to work with new build API.
-
2.0.8+110 Jan 2019 -
2.0.717 Sep 2018Release notes
Open source →- Bug fix #132: We used to generate terms like
prefix2.di.injectin order to denote a top level declaration namedinject, but that's an error becausediis an import prefix from client code. We now strip off such prefixes (yieldingprefix2.inject) in the cases reported in issue #132.
- Bug fix #132: We used to generate terms like
-
2.0.606 Sep 2018Release notes
Open source →- Adjusts an implementation class (
MixinApplication) such that a compile-time error occurring with analyzer 0.32.5 is avoided.
- Adjusts an implementation class (
-
2.0.530 Aug 2018Release notes
Open source →-
Enhancement of the support for reflection on type arguments, covering cases where a type annotation is a parameterized type where all type arguments are resolved statically (e.g.,
List<int> f();). We (still) do not support cases where one or more type arguments are or contain type variables from an enclosing function or class (like the type of the formal parameter toList.addAll:List<E>), and with such type arguments a dynamic error is raised if an attempt is made to access it. Similarly, we (still) do not support extracting the value of the actual type arguments for an instance of a generic class (e.g., for a given list, we cannot obtain the precise value of the actual type argument; we can test things likemyList is List<num>andmyList is List<String>without reflection at all, but that only reveals an upper bound, not the precise value of the type argument, and we cannot get that precise value without support for some additional primitives). -
The
build.yamlfile in reflectable was adjusted such that a much larger set of files are included for code generation. This means that we will err on the side of generating code for too many files rather than too few, but this choice seems to be more user-friendly. Developers who get irritated about seeing warnings like "This reflector does not match anything" (which is a likely outcome for code generation applied to some arbitrary library which is not an entry point) can then add abuild.yamlfile specifying more precisely which libraries to generate code for.
-
-
2.0.422 Aug 2018