Skip to content

Commit 21d3a1a

Browse files
committed
Release V9.1.0
1 parent 38c68a6 commit 21d3a1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+160486
-60
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,5 +486,9 @@ android/local.properties
486486
.vscode/settings.json
487487
example/ios/Flutter/flutter_export_environment.sh
488488

489+
# code coverage files
489490
# code coverage files
490491
coverage
492+
493+
# DevTools Extension
494+
!extension/devtools/build/

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [9.1.0] - 2025-11-20
2+
3+
* Added DevTools extension for visualizing and inspecting GetIt registrations
4+
* View all registered objects with their type, scope, registration mode, and state
5+
* See instance details via `toString()` output for created instances
6+
* Manual refresh button to update the registration list
7+
* Requires `debugEventsEnabled = true` to be set on GetIt instance
8+
* See README for setup instructions
9+
110
## [9.0.5] - 2025-01-12
211

312
* Use absolute GitHub URL for logo in README

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,46 @@ tearDown(() async {
141141

142142
[Read testing guide →](https://flutter-it.dev/documentation/get_it/testing)
143143

144+
### DevTools Extension
145+
146+
get_it includes a DevTools extension that lets you visualize and inspect all registered objects in your running app:
147+
148+
- **View all registrations** — See type, instance name, scope, registration mode, async status, ready state, and creation status
149+
- **Instance details** — View the `toString()` output of created instances to inspect their state
150+
- **Manual refresh** — Update the registration list anytime with the refresh button
151+
152+
#### Setup
153+
154+
1. **Enable debug events** in your app (typically in `main.dart`). This enables the extension to receive automatic updates when registrations change:
155+
```dart
156+
void main() {
157+
GetIt.instance.debugEventsEnabled = true;
158+
// ... rest of your setup
159+
runApp(MyApp());
160+
}
161+
```
162+
163+
2. **Run your app** in debug mode and open DevTools
164+
165+
3. **Open DevTools in the browser** — The extension currently only works in the browser-based DevTools, not in the IDE-embedded version.
166+
167+
4. **Enable the extension** — Click the **Extensions** button (puzzle piece icon) in the top right corner of DevTools and enable the `get_it` extension.
168+
169+
5. **Find the "get_it" tab** — The extension will appear as a new tab in DevTools
170+
171+
For more information on using DevTools extensions, see the [official Flutter DevTools documentation](https://docs.flutter.dev/tools/devtools/extensions).
172+
173+
> **💡 Tip:** Override `toString()` in your registered classes to see meaningful details in the DevTools extension. By default, Dart's `toString()` only shows the type name and instance ID.
174+
175+
```dart
176+
class UserRepository {
177+
final String userId;
178+
179+
@override
180+
String toString() => 'UserRepository(userId: $userId)';
181+
}
182+
```
183+
144184
### Flutter Widget Previews
145185

146186
`get_it` works seamlessly with Flutter's widget previewer. Since previews run in isolation, you need to initialize `get_it` within the preview itself:

devtools_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:
4+
- get_it: true

example/android/app/build.gradle

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "org.jetbrains.kotlin.android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,11 +22,8 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply plugin: 'kotlin-android'
26-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27-
2825
android {
26+
namespace 'com.example.example'
2927
compileSdkVersion flutter.compileSdkVersion
3028
ndkVersion flutter.ndkVersion
3129

@@ -62,10 +60,4 @@ android {
6260
}
6361
}
6462

65-
flutter {
66-
source '../..'
67-
}
6863

69-
dependencies {
70-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71-
}

example/android/build.gradle

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,18 @@
1-
buildscript {
2-
ext.kotlin_version = '1.7.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.2.0'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
}
12-
}
13-
14-
allprojects {
15-
repositories {
16-
google()
17-
mavenCentral()
18-
}
19-
}
20-
21-
rootProject.buildDir = '../build'
22-
subprojects {
23-
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
}
25-
subprojects {
26-
project.evaluationDependsOn(':app')
27-
}
28-
29-
task clean(type: Delete) {
30-
delete rootProject.buildDir
31-
}
1+
allprojects {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
}
7+
8+
rootProject.buildDir = '../build'
9+
subprojects {
10+
project.buildDir = "${rootProject.buildDir}/${project.name}"
11+
}
12+
subprojects {
13+
project.evaluationDependsOn(':app')
14+
}
15+
16+
tasks.register("clean", Delete) {
17+
delete rootProject.layout.buildDirectory
18+
}

example/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip

example/android/gradlew

100644100755
File mode changed.

example/android/settings.gradle

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
511

6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
}
818

9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
19+
plugins {
20+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21+
id "com.android.application" version "8.3.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
23+
}
24+
25+
include ":app"

example/devtools_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
description: This file stores settings for Dart & Flutter DevTools.
2+
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
3+
extensions:
4+
- get_it: true

0 commit comments

Comments
 (0)