zaynOm
zaynOm

Reputation: 153

Kotlin print() method dosen't work in Flutter

I'm trying to debug android native code (kotlin) for flutter using the print().

The problem I'm facing is that it doesn't print in the console when I run the app.

class MainActivity : FlutterActivity() {
    private val channel = "com.example.pomo_app/mychannel"

        MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channel)  
          .setMethodCallHandler { call, result ->
                    when (call.method) {
                        "getAllRingtones" -> {
                            // this doesn't print to console
                            print("Native code works")
                          
                        }

Upvotes: 5

Views: 4515

Answers (1)

Eugene Kuzmenko
Eugene Kuzmenko

Reputation: 1497

You have to use Log.d("TAG", "your log message") for Android native logs.

Kotlin print() and println() methods won't work.

Bit if you want to log some native ios code, you can use print() and println() methods in Swift

Upvotes: 17

Related Questions