-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Description
After hours of trying to figure out why I can't write a record to any tag, turns out it's with custom object. I can jsonEncode a map like so:
payload: Uint8List.fromList(utf8.encode(jsonEncode({"name": "John Doe", "balance": 5}))),but I cannot do that:
payload: Uint8List.fromList(utf8.encode(User(name: "John Doe", balance: 5).toJson())),I also cannot do that. It won't work.
payload: Uint8List.fromList(utf8.encode(jsonEncode(User(name: "John Doe", balance: 5).toMap()))),Doing so throws the following exception and erases the tag:
I/flutter (14958): PlatformException(IOException, java.io.IOException, Cause: null, Stacktrace: java.io.IOException
I/flutter (14958): at android.nfc.tech.Ndef.writeNdefMessage(Ndef.java:322)
I/flutter (14958): at dev.flutter.plugins.nfcmanager.NfcManagerPlugin.ndefWriteNdefMessage(NfcManagerPlugin.kt:106)
I/flutter (14958): at dev.flutter.plugins.nfcmanager.HostApiPigeon$Companion.setUp$lambda$14$lambda$13(Pigeon.kt:1003)
I/flutter (14958): at dev.flutter.plugins.nfcmanager.HostApiPigeon$Companion.$r8$lambda$91TyEKJbMGmI0keR7OHW8yRfoiw(Unknown Source:0)
I/flutter (14958): at dev.flutter.plugins.nfcmanager.HostApiPigeon$Companion$$ExternalSyntheticLambda37.onMessage(D8$$SyntheticClass:0)
I/flutter (14958): at io.flutter.plugin.common.BasicMessageChannel$IncomingMessageHandler.onMessage(BasicMessageChannel.java:261)
I/flutter (14958): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
I/flutter (14958): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:319)
I/flutter (14958): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run
Metadata
Metadata
Assignees
Labels
No labels