Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aguilaair/updat
A simple-to-use flutter update package for Windows, MacOS, and Linux.
https://github.com/aguilaair/updat
Last synced: 8 days ago
JSON representation
A simple-to-use flutter update package for Windows, MacOS, and Linux.
- Host: GitHub
- URL: https://github.com/aguilaair/updat
- Owner: aguilaair
- License: mpl-2.0
- Created: 2022-08-02T13:52:45.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T19:14:20.000Z (about 1 year ago)
- Last Synced: 2023-11-22T20:24:38.178Z (about 1 year ago)
- Language: Dart
- Size: 6.19 MB
- Stars: 31
- Watchers: 4
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Updat - The simple-to-use, flutter-based desktop update package
![Logo](https://github.com/aguilaair/updat/assets/17295513/b7a60ca6-bc87-4abc-82fa-cf327ef73504)
Updat is a simple-to-use reliable flutter-native updater that handles your application's updates. All you need is a place to host your files and a place to check for the latest version.
## Demo
![demo](https://github.com/aguilaair/updat/assets/17295513/9e0be181-0772-4cf9-8c4e-8933b407137f)
## Installing
To get started simply type `flutter pub add updat` in your terminal.
🎉 Done, It's that simple.
## Getting Started
Integration with your app requires just a few lines of code, add the following widget wherever you want your updat widget to be:
```dart
UpdatWidget(
currentVersion: "1.0.0",
getLatestVersion: () async {
// Here you should fetch the latest version. It must be semantic versioning for update detection to work properly.
return "1.0.1";
},
getBinaryUrl: (latestVersion) async {
// Here you provide the link to the binary the user should download. Make sure it is the correct one for the platform!
return "https://github.com/latest/release/bin.exe";
},
// Lastly, enter your app name so we know what to call your files.
appName: "Updat Example",
),
```That should get you up and running in just a few seconds ⚡️.
or use the `UpdatWindowManager`, and let updat handle everything on autopilot. Just place it right after your `MaterialApp`.
Want to learn how to integrate Updat in your app?
[Integration Instructions](https://github.com/aguilaair/updat/wiki/How-to-integrate-Updat)
## Configuration
### Available `UpdatWidget` arguments
| Parameter | Type | Value | Default |
|:------------------------------|:-----------------------------|:---------------------------------------------------------------------------------------------------------------------|:--------|
| **`currentVersion`** | `String` | **Required**. Must be a semantic version. This is the current package's version. | N/A |
| **`getLatestVersion`** | `Future` | **Required**. Must be a semantic version. This should request the latest version to the server | N/A |
| **`getBinaryUrl`** | `Future` | **Required**. This should provide the link download the binary for a certain app version. Arguments: `latestVersion` | N/A |
| **`appNme`** | `String` | **Required**. The Application's name. It is used to name the binaries when downloading. | N/A |
| **`getChangelog`** | `Future` | This will render a plain text view of the changelog. | N/A |
| **`callback`** | `void Function(UpdatStatus)` | A callback that is called when the UpdatStatus gets updated. | N/A |
| **`getDownloadFileLocation`** | `Future` | Choose where to download the update. | N/A |
| **`updateChipBuilder`** | `Widget Function(...)` | Overrides the default update chip. | N/A |
| **`updateDialogBuilder`** | `Widget Function(...)` | Overrides the default update dialog. | N/A |
| **`openOnDownload`** | `bool` | Whether Updat should open the installer automatically once it has been downloaded. | `true` |
| **`closeOnInstall`** | `bool` | Whether Updat should close the application automatically once it has been downloaded. | `false` |### Theming
![Logo](https://github.com/aguilaair/updat/assets/17295513/05cbe14b-e240-4fe1-95cd-c10fdd51b665)
Updat is extremely easy to theme. We also use `updateChipBuilder` and `updateDialogBuilder` internally to design our widgets, so you have the same customizability we do. We provide a couple of themes to get you started.
To change the theme simply add the desired theme to the builder and you're set.
#### Chips
- `defaultChip` which is an elevatedButton that only shows when an update is available. Shown by default.
- `defaultChipWithCheckFor` which is an elevatedButton that shows under all conditions, allowing to recheck for updates.
- `defaultChipWithSilentDownload` which is an elevatedButton that only shows when an update is downloaded and ready to install.- `flatChip` which is an textButton that only shows when an update is available
- `flatChipWithCheckFor` which is an textButton that shows under all condition, allowing to recheck for updates.
- `flatChipWithSilentDownload` which is an textButton that only shows when an update is downloaded and ready to install.- `floatingExtendedChip` which is a compact version of the dialog, which is a bit bigger and grabs user's attention more easily.
- `floatingExtendedChipWithSilentDownload` which is a compact version of the dialog, which is a bit bigger and grabs user's attention more easily, and only shows when the update is ready to be installed.#### Dialogs
- `defaultDialog` which is the default, M2 and M3 dialog that shows by default.
### Advanced Usage
If you need to send additional HTTP headers when downloading a release asset, you may define your
headers by setting the `downloadReleaseHeaders` property of `UpdatGlobalOptions`, you should probably do this in the main function of your code.
```dart
UpdatGlobalOptions.downloadReleaseHeaders = {
"Authorization": "Bearer gh_pat_1234567889abcdefghijklm",
}
```