Member-only story

Theme Changes In Flutter, Injecting Services

Fred Grott
2 min readDec 26, 2022

--

There are several ways to inject services, so let me use the theme service injection to cover injecting services into Flutter apps.

Ways To Inject Services

There are two types of services in Flutter:

-Services That are pure in that they do not have Flutter framework dependencies

-Services that have flutter framework dependencies

Services that are pure if they have a small memory footprint can be injected through use of singleton. Let me show the standard logging service example.

The Logging Service Singleton

Generally, a dart singleton has an instance, a factory, and a private reference:

Dart Singleton

--

--

Fred Grott
Fred Grott

No responses yet