Skip to content

Commit ec2ec2b

Browse files
authored
[CQ] API: migrate FlutterSdkManager off projectOpened (#8123)
Move `FlutterSdkManager` (unstable) post-project open initialization to a (supported) `ProjectActivity`. See: #8100, #6953 --- - [x] I’ve reviewed the contributor guide and applied the relevant portions to this PR. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide]([https://github.com/dart-lang/sdk/blob/main/CONTRIBUTING.md](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Dart contributions to our repos should follow the [Dart style guide](https://dart.dev/guides/language/effective-dart) and use `dart format`. - Java and Kotlin contributions should strive to follow Java and Kotlin best practices ([discussion](#8098)). </details>
1 parent 8055275 commit ec2ec2b

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright 2025 The Chromium Authors. All rights reserved.
3+
* Use of this source code is governed by a BSD-style license that can be
4+
* found in the LICENSE file.
5+
*/
6+
7+
package io.flutter.sdk
8+
9+
import com.intellij.openapi.project.Project
10+
import com.intellij.openapi.startup.ProjectActivity
11+
12+
class FlutterProjectActivity : ProjectActivity {
13+
override suspend fun execute(project: Project) {
14+
FlutterSdkManager.getInstance(project).checkForFlutterSdkChange()
15+
}
16+
}

flutter-idea/src/io/flutter/sdk/FlutterSdkManager.java

-14
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,6 @@ private FlutterSdkManager(@NotNull Project project) {
5252
});
5353

5454
ProjectManager.getInstance().addProjectManagerListener(myProject, new ProjectManagerListener() {
55-
//See https://plugins.jetbrains.com/docs/intellij/plugin-components.html#comintellijpoststartupactivity
56-
// for notice and documentation on the deprecation intentions of
57-
// Components from JetBrains.
58-
//
59-
// Migration forward has different directions before and after
60-
// 2023.1, if we can, it would be prudent to wait until we are
61-
// only supporting this major platform as a minimum version.
62-
//
63-
// https://github.com/flutter/flutter-intellij/issues/6953
64-
@Override
65-
public void projectOpened(@NotNull Project project) {
66-
checkForFlutterSdkChange();
67-
}
68-
6955
@Override
7056
public void projectClosed(@NotNull Project project) {
7157
checkForFlutterSdkChange();

resources/META-INF/plugin.xml

+1
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@
361361
serviceImplementation="io.flutter.bazel.WorkspaceCache"/>
362362
<projectService serviceImplementation="io.flutter.pub.PubRootCache"/>
363363

364+
<backgroundPostStartupActivity implementation="io.flutter.sdk.FlutterProjectActivity"/>
364365
<backgroundPostStartupActivity id="FontPreviewStartupActivity"
365366
implementation="io.flutter.font.FontPreviewStartupActivity"
366367
order="last"/>

resources/META-INF/plugin_template.xml

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@
269269
serviceImplementation="io.flutter.bazel.WorkspaceCache"/>
270270
<projectService serviceImplementation="io.flutter.pub.PubRootCache"/>
271271

272+
<backgroundPostStartupActivity implementation="io.flutter.sdk.FlutterProjectActivity"/>
272273
<backgroundPostStartupActivity id="FontPreviewStartupActivity"
273274
implementation="io.flutter.font.FontPreviewStartupActivity"
274275
order="last"/>

0 commit comments

Comments
 (0)