build_support library
Helpers for build and CI scripts: read pubspec.yaml and the package
config (pathGetPubspecYamlMap, pubspecYamlSupportsFlutter,
pathGetResolvedPackagePath), sdk constraints (VersionBoundaries), find
a package root (isPubPackageRoot), install pub tools
(checkAndInstallCliPackage with dart install,
checkAndPubGlobalActivatePackage) and create projects
(dartCreateProject, flutterCreateProject). io only.
Classes
- DartInstalledCliPackage
-
A package installed with
dart install, a line ofdart installed [--all](Dart 3.10+). - VersionBoundaries
- Version boundaries.
- VersionBoundary
- Version boundary.
Enums
- PubDependencyKind
- Pub dependency kind.
Extensions
- VersionBoundaryVersionExt on Version
- Public helper
Constants
- dartTemplateConsole → const String
- console: A command-line application. (default)
- dartTemplateConsoleSimple → const String
- console-simple: A simple command-line application. (default) @Deprecated
- dartTemplatePackage → const String
- package: A package containing shared Dart libraries
- dartTemplateWeb → const String
- web: A web app that uses only core Dart libraries.
- flutterTemplateApp → const String
- app: A Flutter application.
- flutterTemplatePackage → const String
- Flutter package shared dart code.
Properties
- buildSupportsAndroid → bool
-
Always allowed for now
no setter
- buildSupportsIOS → bool
-
For now based on x-code presence.
no setter
- buildSupportsLinux → bool
-
Build supports Linux
no setter
- buildSupportsMacOS → bool
-
Build supports MacOS
no setter
- buildSupportsWindows → bool
-
Build supports Windows
no setter
- isFlutterSupportedSync → bool
-
true if flutter is supported
no setter
- isNodeSupportedSync → bool
-
true if flutter is supported
final
Functions
-
buildInitDart(
) → Future< void> - Setup minimum Dart support
-
buildInitFlutter(
) → Future< void> - Setup minimum flutter support
-
checkAndActivatePackage(
String package, {bool? verbose}) → Future< bool> -
Prefer checkAndPubGlobalActivatePackage (or
PubGlobalPackageServicefor version boundaries). -
checkAndActivateWebdev(
{bool? verbose}) → Future< void> - Check if webdev is activated.
-
checkAndInstallCliPackage(
String package, {bool? verbose}) → Future< bool> -
Install a package executables with
dart installif not installed yet. -
checkAndInstallCliWebdev(
{bool? verbose}) → Future< void> -
Check if webdev is installed with
dart install, install or update it if needed. -
checkAndPubGlobalActivatePackage(
String package, {bool? force, bool? verbose}) → Future< bool> -
Activate a package with
dart pub global activateif not activated yet. -
checkOrPubActivateDevBuild(
{bool? verbose, VersionBoundaries? versionBoundaries}) → Future< void> - Get dev_build pub global update
-
dartCreateProject(
{String template = dartTemplateConsoleSimple, required String path}) → Future< void> - Create a dart project.
-
flutterCreateProject(
{required String path, String template = flutterTemplateApp, List< String> ? platforms, bool? noAnalyze}) → Future<void> - Create a flutter project.
-
getDartInstalledPackages(
{bool? all, bool? force, bool? verbose}) → Future< List< DartInstalledCliPackage> > -
Get the packages installed with
dart install(with a local cache, per isolate). -
getPubGlobalInstalledPackages(
{bool? force, bool? verbose}) → Future< List< String> > -
Get the list of packages activated with
dart pub global activate(with a local cache, per isolate). -
getPubPackageRoot(
String resolverPath, {FilterDartProjectOptions? filterDartProjectOptions}) → Future< String> - throws if no project found
-
getPubPackageRootSync(
String resolverPath) → String - throws if no project found, returns the nearest pub package root from a given path (could be current dir using '.')
-
isPubPackageRoot(
String dirPath, {bool verbose = false, FilterDartProjectOptions? filterDartProjectOptions}) → Future< bool> - return true if root package Check whether the package contains a supported version
-
isPubPackageRootSync(
String dirPath) → bool - @Deprecated('Use isPubPackageRoot')
-
nodeSetupCheck(
String dir) → Future - Install node modules for test.
-
packageConfigGetPackages(
Map packageConfigMap) → List< String> - Get a list of packages
-
parseDartInstalledCliPackages(
Iterable< String> lines) → List<DartInstalledCliPackage> -
Parse
dart installed [--all]output lines, other lines are ignored. -
pathGetAnalysisOptionsYamlMap(
String packageDir) → Future< Map< String, Object?> > - Read analysis_options.yaml file (io only)
-
pathGetPackageConfigMap(
String packageDir) → Future< Map< String, Object?> > - Map a package to a location
-
pathGetPubspecYamlMap(
String packageDir) → Future< Map< String, Object?> > - Read pubspec.yaml file (io only)
-
pathGetResolvedPackagePath(
String path, String package, {bool? windows}) → Future< String?> - Shortcut to get a dependency, not officient as it reads multiple times the package_config.json file.
-
pathPackageConfigMapGetPackagePath(
String path, Map packageConfigMap, String package, {bool? windows}) → String? - Get a library path, you can get the project dir through its parent null if not found
-
pathPubspecAddDependency(
String dir, String dependency, {List< String> ? dependencyLines}) → Future<bool> - Returns true if added
-
pathPubspecGetDependencyLines(
String dir, String dependency) → Future< List< String> ?> - Null if not a dependency, formatted on a single line with depencency prefix or multiple lines
-
pathPubspecRemoveDependency(
String dir, String dependency) → Future< bool> - Returns true if removed
-
pubspecYamlGetDependenciesMap(
Map yaml, {PubDependencyKind? kind}) → Model? - Get the dependency map
-
pubspecYamlGetDependenciesPackageName(
Map yaml, {PubDependencyKind? kind}) → Iterable< String> - Get the dependencies packages name.
-
pubspecYamlGetPackageName(
Map yaml) → String? - Get the package name from pubspec.yaml
-
pubspecYamlGetSdkBoundaries(
Map? map) → VersionBoundaries? - Get sdk boundaries
-
pubspecYamlGetVersion(
Map yaml) → Version - Get the package version from pubspec.yaml
-
pubspecYamlGetVersionOrNull(
Map yaml) → Version? - Get the package version from pubspec.yaml Could be not valid for workspace
-
pubspecYamlHasAnyDependencies(
Map yaml, List< String> dependencies) → bool - True if the pubspec.yaml has any of the dependencies
-
pubspecYamlHasWorkspaceResolution(
Map map) → bool - True if the pubspec.yaml has a workspace resolution
-
pubspecYamlIsWorkspaceRoot(
Map map) → bool - True if the pubspec.yaml is a workspace root
-
pubspecYamlSupportsFlutter(
Map map) → bool - True if the pubspec.yaml has the flutter dependency.
-
pubspecYamlSupportsNode(
Map map) → bool - True if the pubspec.yaml has the node build dependency. Not supported.
-
pubspecYamlSupportsTest(
Map map) → bool - True if the pubspec.yaml has the test dependency.
-
pubspecYamlSupportsWeb(
Map map) → bool - True if the pubspec.yaml has the web dependency.
-
uninstallCliPackage(
String package, {bool? verbose}) → Future< bool> -
Uninstall a package installed with
dart install.