This plugin allows Flutter desktop apps to automatically update themselves (based on sparkle).
By default Sparkle will not be part of your app, so you have to first set env ENABLE_SPARKLE=1 in your terminal,
After adding this plugin, either export ENABLE_SPARKLE=1 to your terminal, or run all commands with this env,
flutter clean && flutter pub get
cd macos
ENABLE_SPARKLE=1 pod installThis will include the sparkle framework in your app
To remove Sparkle framework, repeat these commands, without env
flutter clean && flutter pub get
cd macos
pod installimport 'package:sparkle_flutter/sparkle_flutter.dart';
void main() async {
// Must add this line.
WidgetsFlutterBinding.ensureInitialized();
String feedURL = 'http://localhost:5002/appcast.xml';
await SparkleFlutter.initialize(feedUrl: feedUrl);
await SparkleFlutter.checkForUpdates();
await SparkleFlutter.setScheduledCheckInterval(3600);
runApp(MyApp());
}Please see the example app of this plugin for a full example.
Run the following command:
dart run sparkle_flutter:generate_keysPrepare signing with EdDSA signatures, and add that in your info.plist file
Output:
A key has been generated and saved in your keychain. Add the `SUPublicEDKey` key to
the Info.plist of each app for which you intend to use Sparkle for distributing
updates. It should appear like this:
<key>SUPublicEDKey</key>
<string>pfIShU4dEXqPd5ObYNfDBiQWcXozk7estwzTnF9BamQ=</string>build your flutter mac app first with: flutter build macos
Get your app: YOUR_MAC_APP_NAME.app
Install 7zip
brew install p7zipzip it with 7zip
7z a "OUTPUT_UPDATE_NAME" "YOUR_MAC_APP_NAME.app/*"Run the following command:
dart run sparkle_flutter:sign_update YOUR_MAC_APP_ZIP_FILE_PATH.zipOutput:
sparkle:edSignature="pbdyPt92pnPkzLfQ7BhS9hbjcV9/ndkzSIlWjFQIUMcaCNbAFO2fzl0tISMNJApG2POTkZY0/kJQ2yZYOSVgAA==" length="13400992"Update the obtained new signature to the value of the sparkle:edSignature attribute of the enclosure node of the appcast.xml file.
<item>
<title>Version 1.1.0</title>
<sparkle:releaseNotesLink>
https://your_domain/your_path/release_notes.html
</sparkle:releaseNotesLink>
<pubDate>Sun, 16 Feb 2025 12:00:00 +0800</pubDate>
<enclosure
url="your update zip url"
sparkle:version="1.1.0+2"
sparkle:os="macos"
sparkle:dsaSignature="ADD YOUR SIGNATURE HERE"
length="ADD LENGTH HERE"
type="application/octet-stream" />
</item>