Skip to content

Conversation

@pq
Copy link
Collaborator

@pq pq commented Apr 24, 2025

A bit pedantic but generally good practice and easy to fix. (There's also no real reason to store the instance.)

image

Inspection motivation:

Such services' assignments contribute to global state and make it impossible to tear down an application and set up another one in tests, therefore, repeated tests in the same process may fail. The only exception is an explicit constructor call to store dummy/default instances.
The recommended way to avoid storing services is to retrieve a service locally. Alternatively, one can wrap it in java.util.function.Supplier (Java, Kotlin) or convert the property to a function (Kotlin).


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

@pq pq requested a review from jwren April 24, 2025 23:31
@jwren jwren added this to the M85.3 milestone Apr 24, 2025
@pq pq merged commit b3a9274 into flutter:master Apr 24, 2025
7 checks passed
@pq pq deleted the cq_FlutterSurveyService_serviceAssignment branch April 24, 2025 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants