gate_generator 1.1.0 copy "gate_generator: ^1.1.0" to clipboard
gate_generator: ^1.1.0 copied to clipboard

Dependency Injection generator for your flutter/dart applications. This uses annotations and build_runner.

example/README.md

import 'package:gate/gate.dart';

@Injectable()
class UserService {
  UserService._();

  @Singleton()
  factory UserService.build() => UserService._();

  String get userId => "31345421";
}

@Inject(children: [
  InjectedChild(UserService, factoryName: 'build'),
])
class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(32.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const SizedBox(height: 40),
            const Text("User", style: TextStyle(fontSize: 21)),
            Text(userService.userId, style: const TextStyle(fontSize: 14)),
          ],
        ),
      ),
    );
  }
}
21
likes
100
pub points
19%
popularity

Publisher

verified publisherapparence.io

Dependency Injection generator for your flutter/dart applications. This uses annotations and build_runner.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

analyzer, build, code_builder, dart_style, gate, glob, meta, path, quiver, source_gen, universal_io

More

Packages that depend on gate_generator