Skip to content

Instantly share code, notes, and snippets.

View filipkowicz's full-sized avatar
🤖

Michał Filipek filipkowicz

🤖
View GitHub Profile
@verno3632
verno3632 / InstantTaskExecutorExtension.kt
Created September 6, 2018 23:10
Extension to test with LiveData in JUnit5
class InstantTaskExecutorExtension : BeforeAllCallback {
override fun beforeAll(context: ExtensionContext?) {
ArchTaskExecutor.getInstance().setDelegate(object : TaskExecutor() {
override fun executeOnDiskIO(runnable: Runnable) {
runnable.run()
}
override fun postToMainThread(runnable: Runnable) {
runnable.run()
}
@matteocrippa
matteocrippa / flutter.md
Last active October 26, 2023 05:47
Flutter Cheatsheet

Flutter

A quick cheatsheet of useful snippet for Flutter

Widget

A widget is the basic type of controller in Flutter Material. There are two type of basic Widget we can extend our classes: StatefulWidget or StatelessWidget.

Stateful

StatefulWidget are all the widget that interally have a dynamic value that can change during usage. It can receive an input value in the constructor or reference to functions. You need to create two classes like:

@ferrerojosh
ferrerojosh / AndroidWorkerInjection.kt
Created May 30, 2018 06:40
androidx workmanager injector temporary impl
import androidx.work.Worker
object AndroidWorkerInjection {
fun inject(worker: Worker) {
checkNotNull(worker, { "worker" })
val application = worker.applicationContext
if (application !is HasWorkerInjector) {
throw RuntimeException("${application.javaClass.canonicalName} does not implement ${HasWorkerInjector::class.java.canonicalName}")
}