Skip to content

Instantly share code, notes, and snippets.

@pritam-quantum-inventions
Last active September 26, 2021 12:12
Show Gist options
  • Save pritam-quantum-inventions/350b1ca8da308182f62dcd1bd6969294 to your computer and use it in GitHub Desktop.
Save pritam-quantum-inventions/350b1ca8da308182f62dcd1bd6969294 to your computer and use it in GitHub Desktop.
get method names passed from dart
private val CHANNEL = "bluetooth.channel"
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
when (call.method) {
"getBlue" -> bluetoothWrapper(result)
"discoverBlue" -> discoverDevices(result)
"allPaired" -> getConnectedDevices(result)
"connectDevice" -> connectToDevice(call.arguments as String, result)
"disconnectSocket" -> disconnectSocket(result)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment