isValid static method

(bool, String?) isValid(
  1. YamlMap data,
  2. TargetPlatform tp
)

Checks if the given config in the pubspec is valid or not

Should be called before the fromMap function

Implementation

static (bool, String?) isValid(yaml.YamlMap data, TargetPlatform tp) {
  if (!data.containsKey("bundleID") || data["bundleID"] == "") {
    return (false, "'bundleID' is missing from the publish config for ${tp.name}. The bundle id is structured as 'com.example.your_app'.");
  }

  if (!data.containsKey("releaseTrack") || data["releaseTrack"] == "") {
    return (false, "'releaseTrack' is missing from the publish config for ${tp.name}. It determines the the type of the release you plan to create, such as 'internal' or 'beta'.");
  }

  if (!data.containsKey("outputFilePath") || data["outputFilePath"] == "") {
    String examplePath = "build/app/outputs/bundle/release/app-release.aab";
    return (
      false,
      "'outputFilePath' is missing from the publish config for ${tp.name}. This is the path to the build file generated by the 'flutter build' command. e.g. $examplePath",
    );
  }

  return (true, null);
}