dart-lang / dart-lang/http

Best practices on if and when you should close HTTP connections in flutter apps?

Open
#422 24 comments 66 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.1k
Forks
419
Avg merge
4d 14h
Merged PRs (30d)
8

Description

According to the docs it says:

> If you're making multiple requests to the same server, you can keep open a persistent connection by using a Client rather than making one-off requests. If you do this, make sure to close the client when you're done:

However, in most mobile apps, you tend to send most requests to a single server.

Does that mean, for an app that does a lot of API calls to a server, that we should keep the connection up throughout the app lifetime?

Also should we close and re-open the connection when the app suspends and resume states?

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the HTTP Client documentation passage quoted in the issue and the existing discussion about Flutter app suspension and resumption. Clarify when a persistent client should be retained or closed, including lifecycle guidance, and update the relevant documentation once the maintainers agree on the recommendation.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.