sdkType method

  1. @override
String? sdkType(
  1. String? flutterRootPath
)
override

Returns 'Dart' or 'Flutter' (preferentially, 'Flutter' when the answer is "both"), or null if this package is not part of a SDK.

Implementation

@override
String? sdkType(String? flutterRootPath) {
  if (flutterRootPath != null) {
    var flutterPackages = pathContext.join(flutterRootPath, 'packages');
    var flutterBinCache = pathContext.join(flutterRootPath, 'bin', 'cache');

    /// Don't include examples or other non-SDK components as being the
    /// "Flutter SDK".
    var canonicalizedDir = pathContext
        .canonicalize(resourceProvider.pathContext.absolute(dir.path));
    if (pathContext.isWithin(flutterPackages, canonicalizedDir) ||
        pathContext.isWithin(flutterBinCache, canonicalizedDir)) {
      return 'Flutter';
    }
  }
  return isSdk ? 'Dart' : null;
}