Coder Social home page Coder Social logo

Comments (11)

peter910921 avatar peter910921 commented on August 18, 2024 1

Can you post a minimal example to reproduce it if possible

i think i need some time on this. Will come back to you once i finished the minimal example. Thanks.

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

Hi,

you are referring to add in this line right?

 _signInBloc.state.sessionStateStream.add(SessionState.stopListening);

from local_session_timeout.

peter910921 avatar peter910921 commented on August 18, 2024

Hi,

you are referring to add in this line right?

 _signInBloc.state.sessionStateStream.add(SessionState.stopListening);

Yes this line. Other than this line, i also have a page which login page whenever they press login i will start listen
_signInBloc.state.sessionStateStream.add(SessionState.startListening);

Same thing happen when they press the login button which it will start listening

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

Can you post the code related to AuthBloc? (Onlythe state definition of the bloc)

from local_session_timeout.

peter910921 avatar peter910921 commented on August 18, 2024

Can you post the code related to AuthBloc? (Onlythe state definition of the bloc)

// ignore_for_file: public_member_api_docs, sort_constructors_first
part of 'auth_bloc.dart';

class AuthState extends Equatable {
  final LoadingStatus status;
  final CustomErr err;
  final StreamController<SessionState> sessionStateStream;
  final bool sessionExpired;
  
  AuthState({
    required this.status,
    required this.err,
    required this.user,
    required this.sessionStateStream,
    required this.sessionExpired,
  });
  
  factory AuthState.initial() {
    return AuthState(
      sessionStateStream: StreamController<SessionState>(), 
      sessionExpired: false,
      status: LoadingStatus.initial, 
      err: CustomErr(errMsg: '')
    );
  }
  
  @override
  List<Object> get props => [status];

  @override
  bool get stringify => true;

  AuthState copyWith({
    LoadingStatus? status,
    CustomErr? err,
    StreamController<SessionState>? sessionStateStream,
    SessionConfig? sessionConfig,
    bool? sessionExpired,
  }) {
    return AuthState(
      status: status ?? this.status,
      err: err ?? this.err,
      sessionStateStream: sessionStateStream ?? this.sessionStateStream,
      sessionExpired: sessionExpired ?? this.sessionExpired,
    );
  }
}

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

Little unusual that it goes away after Applocalizations is commented.

While AppLocalizations is not commented, did you notice rebuilds for MaterialApp at any other point (other than sessionStream.add)

from local_session_timeout.

peter910921 avatar peter910921 commented on August 18, 2024

Little unusual that it goes away after Applocalizations is commented.

While AppLocalizations is not commented, did you notice rebuilds for MaterialApp at any other point (other than sessionStream.add)

Everything just working fine actually only until the point i click on the login button which trigger

context.read<AuthBloc>().state.sessionStateStream.add(SessionState.startListening);

then it rebuild but it doesn't happen after i comment out AppLocalizations(). Its really kind a weird, i try to move SessionTimeoutManager to the Login Page, it works without comment AppLocalizations(), but then it is not at the top of the widget tree, so whenever i pushNamed, it cant detect user activity anymore, so i have no choice to put at MaterialApp().

I tried it without using bloc and the result is still the same.

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

Can you post a minimal example to reproduce it if possible

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

@peter910921 let me know if you need any help to create the minimal example

from local_session_timeout.

peter910921 avatar peter910921 commented on August 18, 2024

@SankethBK Hi sorry for the late reply, been busy on my work.

Actually i think i end up changing my app localizations delegates by following the flutter official guide. After that all working fine now.
https://docs.flutter.dev/development/accessibility-and-localization/internationalization

localizationsDelegates: [
    AppLocalizations.delegate,
    GlobalCupertinoLocalizations.delegate,
    GlobalMaterialLocalizations.delegate,
    GlobalWidgetsLocalizations.delegate
],

from local_session_timeout.

SankethBK avatar SankethBK commented on August 18, 2024

Cool

from local_session_timeout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.