Skip to content

Instantly share code, notes, and snippets.

@littleGnAl
Created July 10, 2019 11:06
Show Gist options
  • Save littleGnAl/8c3c637ccb9f1905c3932fdd3190fc4b to your computer and use it in GitHub Desktop.
Save littleGnAl/8c3c637ccb9f1905c3932fdd3190fc4b to your computer and use it in GitHub Desktop.
class MainActivity: FlutterActivity() {
private val sqlDelightManager by lazy {
val accountingRepository = AccountingRepository(Db.getInstance(applicationContext))
SqlDelightManager(accountingRepository)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
GeneratedPluginRegistrant.registerWith(this)
MethodChannel(flutterView, SQLDELIGHT_CHANNEL).setMethodCallHandler { methodCall, result ->
@Suppress("UNCHECKED_CAST")
val args = methodCall.arguments as? Map<String, Any> ?: emptyMap()
sqlDelightManager.methodCall(methodCall.method, args) {
result.success(it)
}
}
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment