A Sublime Text 4 plugin that adds support for Dart/Flutter projects. This plugin adds commands for working with Dart/Flutter projects, and does not provide syntax/autocompletion support.
- If you haven't already, please install LSP and LSP-Dart first. They will provide autocompletion for your Dart code.
- This plugin will try to detect the path to the Flutter and Dart SDK. To define the path manually, define
FLUTTER_ROOT(for Flutter projects) and/orDART_SDK(for Dart projects) in the settings file forLSP-Dart, under the"env"key.FLUTTER_ROOTshould be the path to the Flutter SDKDART_SDKshould be the path to the Dart SDK- If you have per-project settings, define them in the project settings file instead.
- Install this plugin through Package Control.
This plugin allows Dart/Flutter projects to be run through Sublime Text's build system.
To create a build system for running Dart projects, go to Tools -> Build system -> New build system.... A new file will be created. Name it dart.sublime-build, then add the following:
{
"name": "<a name for this build system>",
"selector": "source.dart",
"target": "dart_run",
"cancel": {
"kill": true,
},
// additional arguments passed to 'flutter run' as a list of strings
"args": ["--arg1", "--arg2"],
}To create a build system for running Flutter projects, go to Tools -> Build system -> New build system.... A new file will be created. Name it flutter.sublime-build, then add the following:
{
"name": "<a name for this build system>"
"selector": "source.dart"
"target": "flutter_run",
"cancel": {
"kill": true,
},
// additional arguments passed to 'flutter run' as a list of strings
"args": ["--arg1", "--arg2"],
}To have different build systems for different Sublime projects, instead of making a new build system through the menu, add the above JSON objects
to the list under the "build_systems" key, in the <project-name>.sublime-project file:
{
"folders": [/*...*/],
"build_systems":
[
/* Add build system JSON config here */
{
"name": "Run my project"
"selector": "source.dart"
"target": "flutter_run",
"cancel": {
"kill": true,
},
// additional arguments passed to 'flutter run' as a list of strings
"args": ["--no-sound-null-safety"],
}
]
}- Dart/Flutter commands
-
pub get -
pub add -
fluter clean -
flutter run -
dart run
-
- Hot reload/Restart
- Open ios/android folder in Xcode/Android Studio
- Select device
- Add dependency