This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
Looking up a deactivated widget's ancestor is unsafe - reading or writing tags #89
Comments
At the beginning, I thought it was connected with Navigator but now - it shows an error even without it. After each NFC scan or write - I've got this: [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe. import 'package:flutter/material.dart';
import 'package:nfc_in_flutter/nfc_in_flutter.dart';
import 'dart:async';
class ListScreen extends StatefulWidget {
static const routeName = '/list-screen';
@override
_ListScreenState createState() => _ListScreenState();
}
class _ListScreenState extends State {
@override
Widget build(BuildContext context) {
StreamSubscription _stream;
_stream = NFC.readNDEF().listen((NDEFMessage message) {
var parsedUri = Uri.parse(message.payload);
String nfcId = parsedUri.queryParameters['nfc_id'];
_stream?.cancel();
}, onError: (e) {
//TODO: Check errors.
});
return Scaffold(
body: Container(),
);
}
} Flutter doctor:
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi all,
I am getting error everytime I want to scan NFC tag and go to other screen or write something to tag itself.
Code:
Anyone can suggest a solution? I suspect this is some logical error but I cannot diagnose it
The text was updated successfully, but these errors were encountered: