VersionChecker class
Service that checks the latest published version of zorphy on pub.dev
and can perform a self-update via dart pub global activate.
Constructors
- VersionChecker({required String currentVersion, String packageName = 'zorphy', String apiBaseUrl = 'https://pub.dev', FetchJsonFunction? fetchJson, RunProcessFunction? processRunner})
Properties
- apiBaseUrl → String
-
The pub.dev API URL template.
final
- currentVersion → String
-
The current CLI version (from the _version constant).
final
- fetchJson → FetchJsonFunction?
-
Overrideable JSON fetcher for testing. Defaults to real HTTP.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- packageName → String
-
The package name on pub.dev.
final
- processRunner → RunProcessFunction?
-
Overrideable process runner for testing. Defaults to real Process.run.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
checkForUpdate(
) → Future< UpdateCheckResult> - Check the latest published version on pub.dev.
-
checkForUpdateSync(
{required Map< String, dynamic> pubDevResponse}) → UpdateCheckResult - Synchronous version of checkForUpdate for unit testing version comparison logic directly from a JSON map.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
performUpdate(
) → Future< UpdateResult> -
Perform the self-update by running
dart pub global activate. -
performUpdateAndVerify(
) → Future< UpdateResult> - Perform the update and verify the new version.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited