DartVersionOptions.resolve constructor

DartVersionOptions.resolve(
  1. Object? sourceParamAny, {
  2. bool allowPubName = true,
})

Implementation

factory DartVersionOptions.resolve(
  Object? sourceParamAny, {
  bool allowPubName = true,
}) {
  String? sourceParam = sourceParamAny?.toString();
  var targetPubspec = resolvePubspec(sourceParam);
  if (!targetPubspec.existsSync()) {
    if (sourceParam != null && !sourceParam.contains(separator)) {
      // Treat as a pub.flutter-io.cn
      return DartVersionOptions.forPackage(sourceParam);
    } else {
      throw ArgumentError(
          'The source file ${targetPubspec.absolute.path} does not exist',
          'source');
    }
  } else {
    return DartVersionOptions(source: targetPubspec.absolute.path);
  }
}