Comments (19)
If you don't use GetMaterialApp this isn't a problem for me.
Cool, I'll raise the fix in 1-2 hours you can test if it solves your issue
from local_session_timeout.
Cool, I have released the next version 2.3.2 with this bug fix
from local_session_timeout.
Fyi to reference package from github, add this in your pubspec.yaml
local_session_timeout:
git:
url: https://github.com/SankethBK/local_session_timeout.git
ref: 44d876f19667100e552a65ee672694939b7ed298
and run flutter pub get
from local_session_timeout.
Brilliant!
It's working well now.
Thank you for your help.
from local_session_timeout.
When I call this code sessionStateStream.add(SessionState.startListening) my app refreshes and redirects to the first page.
Is it because of userInactivityTimeout
or appFocusTimeout
? you can print the timeoutEvent
here
if (timeoutEvent == SessionTimeoutState.userInactivityTimeout) {
// logout logic
} else if (timeoutEvent == SessionTimeoutState.appFocusTimeout) {
// logout logic
}
where are you calling startListening
defined in SessionStateController
?
from local_session_timeout.
Hi @SankethBK
Thank you for your reply.
Is it because of userInactivityTimeout or appFocusTimeout? you can print the timeoutEvent here
No, it's only for the sessionStateController.startListening();
.
where are you calling startListening defined in SessionStateController?
After logging in to My Project, the dashboard page opens.
So I tried adding it to this part of the dashboard page, but the project structure is completely redrawn and it returns to the initial state when I started the app.
class _DashboardScreenState extends State<DashboardScreen> {
@override
void initState() {
final sessionStateController = Get.put(SessionStateController());
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
sessionStateController.startListening();
});
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]);
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
...
}
from local_session_timeout.
When I debug, it goes to this part and then redraws, so I don't think this is because of Getx.
I am new to this package, are there any other use cases using this package and Getx?
from local_session_timeout.
Hi @FullstackWEB-developer , ideally calling setState
in the package should not cause rebuilds in child. But I think since you're using GetX for MaterialApp
, the child widget is no longer treated as a const widget and rebuilds the entire widget tree
from local_session_timeout.
Can you try replacing GetMaterialApp
with MaterialApp
widget to confirm if this is the issue
from local_session_timeout.
Hi @FullstackWEB-developer , ideally calling setState in the package should not cause rebuilds in child. But I think since you're using GetX for MaterialApp, the child widget is no longer treated as a const widget and rebuilds the entire widget tree
So how can I fix this?
Shouldn't I use Getx?
Can you try replacing GetMaterialApp with MaterialApp widget to confirm if this is the issue
Let me try but in my project I need to use GetMaterialApp
from local_session_timeout.
So how can I fix this?
Shouldn't I use Getx?
I mean just to confirm if this is the bug. If using MaterialApp
directly solves this issue, I'll raise the fix for this, instead of calling setState
in my package, I'll handle it inside _recordPointerEvents
function without calling setState
from local_session_timeout.
If I don't use GetMaterialApp
this isn't a problem.
But I am not sure how to integrate with Getx without using GetMaterialApp
.
from local_session_timeout.
Thanks
from local_session_timeout.
Try using this commit of the package 44d876f19667100e552a65ee672694939b7ed298
, I have removed the setState that fires immediately after calling startListening
. If it works I'll remove all setStates
they aren't necessary anyway
from local_session_timeout.
Ok
Let me check soon
from local_session_timeout.
I assume other setStates
might be still causing same issue, can you confirm once
from local_session_timeout.
Yes
I checked it
When debugging, these setStates
were called, but re-rendering did not occur.
It's currently working well.
Nothing has changed on my end.
from local_session_timeout.
Great! can you check if it works with this commit as well 9bf30e872b3f8c1a7e662307a3ebbbf2f0598b86
, i have removed all setStates
none of the expected functionality seems to break, if it works well in your case also I'll make a new release with these changes
from local_session_timeout.
I tested it and it also working now
from local_session_timeout.
Related Issues (20)
- can add example handler stop and start session in Provider State Management ?
- Typo?? HOT 1
- Localizations Delegate HOT 11
- Not getting it to work HOT 18
- timeoutEvent == SessionTimeoutState.userInactivityTimeout HOT 16
- SessionTimeoutState.userInactivityTimeout event keep calling even when user is interact with the app . HOT 2
- setState is being called on a deactivated widget
- suggestion HOT 1
- sessionStateStream.add(SessionState.startListening); causes screen navigation issues HOT 4
- Handle SessionTimeoutManager.sessionConfig change HOT 2
- Irregular Session State Stream behaviour HOT 1
- Session manager times out on auth screen HOT 3
- Need login twice when using easy_localization HOT 5
- Flutter Web: SessionTimeoutState.userInactivityTimeout event keep calling even when user interacts with the app HOT 3
- Timeout event is not firing when duration set to 8 hours and app is in background HOT 10
- Warning alert with timer reducing before logout HOT 7
- Does not work a screen that has movement activity HOT 2
- Events are not firing on Samsung S23 Android 14 device HOT 3
- invalidateSessionForAppLostFocus not working when screen is closed - Android 13 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from local_session_timeout.