google / reflectable.dart

Reflectable is a Dart library that allows programmers to eliminate certain usages of dynamic reflection by specialization of reflective code to an equivalent implementation using only static techniques. The use of dynamic reflection is constrained in order to ensure that the specialized code can be generated and will have a reasonable size.
https://pub.dev/packages/reflectable
BSD 3-Clause "New" or "Revised" License
374 stars 56 forks source link

[Question] is it possible build an "Angular Style DI" library using Reflectable? #296

Closed dinbtechit closed 1 year ago

dinbtechit commented 1 year ago

is it possible build an Angular-style DI (Dependency Injection) library using Reflectable with no code generation during the development phase?

For example: The usage of the DI library will be as shown below

@Injectable 
class ServiceA {

}

@Widget
class MyWidget extends StatefulWidget {
  ServiceA serviceA  
  MyWidget(this.serviceA);         // <----<< At the Deployment time I would like to automatically inject an object of serviceA.

}
dinbtechit commented 1 year ago

Created a discussion for this -https://github.com/google/reflectable.dart/discussions/297