Skip to content

Unhandled Exception: Invalid argument(s): Logger has already been closed #130

Description

@vadrian89

Hello,

Is there any way to test if the Logger was closed or not?
Making the instance variable nullable and then using null-aware operator ?. to access it's methods doesn't work.

I am logging API requests and this happens when the repository object is closed, because sometimes the connection is still up when this happens, but the Logger object is closed alread.y

This is how I clean up my repository object:

Future<void> close() async {
    _logger?.i("Closing repository $this");
    dio?.close(force: true);
    await _resultStreamController.close();
    _logger?.close();
  }

As you can see I force close the dio client yet I still get an exception.

It would be helpful if there would be a public getter for "_active" variable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions