Is there a way to remove all session values that are stored in flutter_session ? I have added values to session like following :
await FlutterSession().set('login_data', jsonEncode(response.body));
await FlutterSession().set('company_code', jsonEncode(companycode));
I need to remove them after logout.
Thank you
CodePudding user response:
you could always set them to empty strings or nulls after you logout.
Update I copied it from other topic
You don't need to actively delete objects in Dart.
Dart is a garbage-collected language, so any object that you don't hold any references to will eventually be garbage collected and freed by the runtime system.
So all you have to do is to clear any variables you have that reference the object.
Garbage collection is really implicit in the language specification. The specification doesn't say so that garbage collection exists (it doesn't even mention the concept), but the language and libraries are designed in such a way that garbage collection is possible: Objects that the program cannot find a reference to anywhere also can't affect the program's behavior any more, so it is undetectable that they are being collected and deleted by the garbage collector.
so answer would be x = null