I use a global variable:
String? globalDeviceVersion;
And I set the variable when I connect via bluetooth device and it works good.
The issue is when I want to ‘reset’ the global value and I have tried:
setState(() {
globals.globalDeviceVersion == null;
});
print(globals.globalDeviceVersion);
and without state:
globals.globalDeviceVersion == null;
print(globals.globalDeviceVersion);
The print in both cases just prints the previous value and the global is not set to null.
2
Answers
I think the issue here is you are comparing the globals.globalDeviceVersion to null not changing the value the code would be
Try below code.
and without state: