Skip to content

Instantly share code, notes, and snippets.

@CodyDunlap
CodyDunlap / app_module.dart
Last active December 9, 2019 04:52
Injecting services into Widget's using package:inject
@Injector(const [ServicesModule, ViewModelModule])
abstract class AppComponent {
static Future<AppComponent> create(
ServicesModule servicesModule,
ViewModelModule viewModule,
) async {
return await g.AppComponent$Injector.create(servicesModule, viewModule);
}
@CodyDunlap
CodyDunlap / AccountServiceUnitTest.kt
Last active February 27, 2019 17:13
Dagger 2 Test Component Injection
@Config(application = TestApp::class)
class AccountServiceUnitTest {
@Before
fun setup() {
val testComponent = DaggerTestAppComponent.builder().build()
testComponent.inject(this)
}
//perform tests
}