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 an 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;
}