### Enable Upgrader Debug Logging Output
Source: https://pub.dev/packages/upgrader
Example of the log output generated when debugLogging is set to true.
```text
flutter: upgrader: operatingSystem: ios, version: Version 17.0.1 (Build 21A342)
flutter: upgrader: packageInfo packageName: com.google.Maps
flutter: upgrader: packageInfo appName: Upgrader
flutter: upgrader: packageInfo version: 1.0.0
flutter: upgrader: current locale: en_US
flutter: upgrader: countryCode: US
flutter: upgrader: languageCode: en
flutter: upgrader: download: https://itunes.apple.com/lookup?bundleId=com.google.Maps&country=US&_cb=1708305624824631
flutter: upgrader: response statusCode: 200
flutter: upgrader: UpgraderAppStore: version info: appStoreListingURL: https://apps.apple.com/us/app/google-maps/id585027354?uo=4, appStoreVersion: 6.102.3, installedVersion: 1.0.0, isCriticalUpdate: null, minAppVersion: null, releaseNotes: Thanks for using Google Maps! This release brings bug fixes that improve our product to help you discover new places and navigate to them.
flutter: upgrader: need to evaluate version
flutter: upgrader: blocked: false
flutter: upgrader: debugDisplayAlways: false
flutter: upgrader: debugDisplayOnce: false
flutter: upgrader: hasAlerted: false
flutter: upgrader: installedVersion: 1.0.0
flutter: upgrader: minAppVersion: null
flutter: upgrader: isUpdateAvailable: true
flutter: upgrader: shouldDisplayUpgrade: true
flutter: upgrader: shouldDisplayReleaseNotes: true
flutter: upgrader: current locale: en_US
flutter: upgrader: languageCode: en
flutter: upgrader: showTheDialog title: Update App?
flutter: upgrader: showTheDialog message: A new version of Upgrader is available! Version 6.102.3 is now available-you have 1.0.0.
flutter: upgrader: showTheDialog releaseNotes: Thanks for using Google Maps! This release brings bug fixes that improve our product to help you discover new places and navigate to them.
```
--------------------------------
### iTunes Lookup Output
Source: https://pub.dev/packages/upgrader
Example output format returned by the itunes_lookup command-line tool.
```text
upgrader: download: https://itunes.apple.com/lookup?bundleId=com.google.Maps
upgrader: response statusCode: 200
itunes_lookup bundleId: com.google.Maps
itunes_lookup releaseNotes: Thanks for using Google Maps!
itunes_lookup trackViewUrl: https://apps.apple.com/us/app/google-maps-transit-food/id585027354?uo=4
itunes_lookup version: 5.58
itunes_lookup all results:
{resultCount: 1, results:
...
```
--------------------------------
### Google Play Store Lookup Output
Source: https://pub.dev/packages/upgrader
Example output format returned by the playstore_lookup command-line tool.
```text
playstore_lookup releaseNotes: • Support plus.codes URLs• Bug fixes
playstore_lookup version: 152.0.0
...
```
--------------------------------
### Initialize Upgrader in main.dart
Source: https://pub.dev/packages/upgrader/versions/6.2.0/example
Demonstrates the basic setup for the Upgrader package. Use clearSavedSettings() only during testing to reset internal state.
```dart
/*
* Copyright (c) 2019-2023 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Only call clearSavedSettings() during testing to reset internal values.
await Upgrader.clearSavedSettings(); // REMOVE this for release builds
// On Android, the default behavior will be to use the Google Play Store
// version of the app.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: UpgradeAlert(
child: Scaffold(
appBar: AppBar(title: Text('Upgrader Example')),
body: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Appcast XML Sample
Source: https://pub.dev/packages/upgrader
Example structure of an RSS feed used as an Appcast for version management.
```xml
Debt Now App - Appcast
-
Version 1.15.0
Minor updates and improvements.
Sun, 30 Dec 2018 12:00:00 +0000
```
--------------------------------
### Initialize and display UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/versions/4.10.0/example
Demonstrates the basic setup for the upgrader package, including clearing settings for testing and wrapping the app content with UpgradeAlert.
```dart
/*
* Copyright (c) 2019-2022 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Only call clearSavedSettings() during testing to reset internal values.
await Upgrader.clearSavedSettings(); // REMOVE this for release builds
// On Android, the default behavior will be to use the Google Play Store
// version of the app.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(title: Text('Upgrader Example')),
body: UpgradeAlert(
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/versions/3.2.1/example
Demonstrates the basic setup of the Upgrader package, including clearing saved settings for testing and configuring an Appcast for Android.
```dart
/*
* Copyright (c) 2019 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
// Only call clearSavedSettings() during testing to reset internal values.
Upgrader().clearSavedSettings(); // Remove this for release builds
// On Android, setup the Appcast.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the Store.
final appcastURL =
'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(
title: Text('Upgrader Example'),
),
body: UpgradeAlert(
appcastConfig: cfg,
debugLogging: true,
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Configure Upgrader with Appcast Store
Source: https://pub.dev/packages/upgrader
Example of overriding the default iOS store controller to use an Appcast source.
```dart
const appcastURL = 'https://raw.githubusercontent.com/larryaasen/upgrader/main/test/testappcast.xml';
final upgrader = Upgrader(
storeController: UpgraderStoreController(
onAndroid: () => UpgraderPlayStore(),
oniOS: () => UpgraderAppcastStore(appcastURL: appcastURL, osVersion: Version(0, 0, 0)),
),
);
```
--------------------------------
### Extract Upgrader Version from pubspec.lock
Source: https://pub.dev/packages/upgrader
Example of the entry format for the upgrader package within the pubspec.lock file.
```yaml
upgrader:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
version: "3.6.0"
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/versions/2.7.1/example
Demonstrates the basic setup of the UpgradeAlert widget within a MaterialApp. Use clearSavedSettings() only during testing to reset internal state.
```dart
/*
* Copyright (c) 2019 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
// Only call clearSavedSettings() during testing to reset internal values.
Upgrader().clearSavedSettings();
// On Android, setup the Appcast.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
final appcastURL =
'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(
title: Text('Upgrader Example'),
),
body: UpgradeAlert(
// appcastConfig: cfg,
debugLogging: true,
minAppVersion: '0.00.20',
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Android URL Launcher Error Log
Source: https://pub.dev/packages/upgrader
Example of the error log observed on Android when the URL launcher fails to find a component.
```text
I/UrlLauncher(11833): component name for https://www.google.com/ is null
```
--------------------------------
### Lookup iTunes App Details via CLI
Source: https://pub.dev/packages/upgrader
Run the itunes_lookup.dart script to retrieve app metadata from the iTunes Search API.
```bash
$ dart itunes_lookup.dart bundleid=com.google.Maps
```
--------------------------------
### Configure Android Manifest for URL Launching
Source: https://pub.dev/packages/upgrader
Adds the necessary queries to AndroidManifest.xml to allow the app to launch browser intents.
```xml
```
--------------------------------
### Configure Minimum App Version for Android
Source: https://pub.dev/packages/upgrader
Add this string to the bottom of the full description field in the Google Play Console.
```text
[Minimum supported app version: 1.2.3]
```
--------------------------------
### Check for Outdated Dependencies
Source: https://pub.dev/packages/upgrader/versions/11.5.1/score
Run this command to identify packages that have newer versions available while respecting current constraints.
```bash
dart pub outdated --no-dev-dependencies --up-to-date --no-dependency-overrides
```
--------------------------------
### Add upgrader dependency via CLI
Source: https://pub.dev/packages/upgrader/versions/0.1.0/install
Run this command in your terminal to add the package to your project.
```bash
$ flutter pub add upgrader
```
--------------------------------
### Lookup Google Play Store App Details via CLI
Source: https://pub.dev/packages/upgrader
Run the playstore_lookup.dart script to retrieve app metadata from the Google Play Store.
```bash
$ cd bin
$ dart playstore_lookup.dart id=com.google.android.apps.mapslite
```
--------------------------------
### Configure Minimum App Version for iOS
Source: https://pub.dev/packages/upgrader
Add this string to the bottom of the description field in App Store Connect.
```text
[:mav: 1.2.3]
```
--------------------------------
### Enable Debug Logging
Source: https://pub.dev/packages/upgrader
Enables verbose logging in the Upgrader constructor to inspect parsing behavior.
```dart
debugLogging: true
```
--------------------------------
### Initialize Upgrader in Flutter
Source: https://pub.dev/packages/upgrader/versions/0.1.0/example
Configures the Upgrader settings and wraps the application UI with UpgradeAlert to handle version checking.
```dart
/*
* Copyright (c) 2018 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key) {
Upgrader().clearSavedSettings();
Upgrader().installAppStoreVersion('1.1.0');
Upgrader().installAppStoreListingURL(
'https://itunes.apple.com/us/app/google-maps-transit-food/id585027354?mt=8&uo=4');
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(
title: Text('Upgrader Example'),
),
body: UpgradeAlert(
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Set Minimum App Version in Store Descriptions
Source: https://pub.dev/packages/upgrader/versions/13.0.0
Add these strings to the app store description fields to enforce a minimum version. This overrides the minAppVersion parameter and hides Ignore/Later buttons.
```text
[Minimum supported app version: 1.2.3]
```
```text
[:mav: 1.2.3]
```
--------------------------------
### Downgrade Dependencies
Source: https://pub.dev/packages/upgrader/versions/11.5.1/score
Command to revert package versions to previous states.
```bash
pub downgrade
```
--------------------------------
### Parse Appcast Items
Source: https://pub.dev/packages/upgrader
Demonstrates how to manually parse appcast items from a URI using the Appcast class.
```dart
final appcast = Appcast();
final items = await appcast.parseAppcastItemsFromUri('https://raw.githubusercontent.com/larryaasen/upgrader/main/test/testappcast.xml');
final bestItem = appcast.bestItem();
```
--------------------------------
### Implement Upgrader with Appcast
Source: https://pub.dev/packages/upgrader
Configures the Upgrader widget to use an Appcast store for Android and iOS platforms.
```dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
static const appcastURL =
'https://raw.githubusercontent.com/larryaasen/upgrader/main/test/testappcast.xml';
// Pass the actual OS version for accurate Appcast item filtering.
// See example/lib/main_appcast.dart for how to retrieve the OS version
// using the device_info_plus package.
static final upgrader = Upgrader(
storeController: UpgraderStoreController(
onAndroid: () => UpgraderAppcastStore(appcastURL: appcastURL, osVersion: Version(0, 0, 0)),
oniOS: () => UpgraderAppcastStore(appcastURL: appcastURL, osVersion: Version(0, 0, 0)),
),
);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(title: const Text('Upgrader Appcast Example')),
body: UpgradeAlert(
upgrader: upgrader,
child: const Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Query iTunes Search API
Source: https://pub.dev/packages/upgrader
Use the ITunesSearchAPI class to programmatically fetch app details by bundle ID.
```dart
final iTunes = ITunesSearchAPI();
final resultsFuture = iTunes.lookupByBundleId('com.google.Maps');
resultsFuture.then((results) {
print('results: $results');
});
```
--------------------------------
### Integrate Upgrader with GoRouter
Source: https://pub.dev/packages/upgrader
Provide a navigatorKey to the UpgradeAlert widget to ensure the correct route context is used with GoRouter.
```dart
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'Upgrader GoRouter Example',
routerConfig: routerConfig,
builder: (context, child) {
return UpgradeAlert(
navigatorKey: routerConfig.routerDelegate.navigatorKey,
child: child ?? const Text('child'),
);
},
);
}
```
--------------------------------
### Display UpgradeCard Widget
Source: https://pub.dev/packages/upgrader
Return an UpgradeCard widget to display an update notification card that automatically collapses when no update is detected.
```dart
return Container(
margin: EdgeInsets.fromLTRB(12.0, 0.0, 12.0, 0.0),
child: UpgradeCard());
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/versions/0.10.0/example
Configures the Upgrader package with an Appcast URL and wraps the application body with UpgradeAlert to handle update prompts.
```dart
/*
* Copyright (c) 2019 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
Upgrader().clearSavedSettings();
// On Android, setup the Appcast.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
final appcastURL =
'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml';
final cfg = AppcastConfiguration(url: appcastURL, supportedOS: ['android']);
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(
title: Text('Upgrader Example'),
),
body: UpgradeAlert(
appcastConfig: cfg,
debugLogging: true,
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### Implement UpgradeAlert in CupertinoApp
Source: https://pub.dev/packages/upgrader
Use UpgradeAlert with dialogStyle set to cupertino when using CupertinoApp. UpgradeCard is not supported in this context.
```dart
@override
Widget build(BuildContext context) {
return CupertinoApp(
title: 'Upgrader Example',
home: CupertinoPageScaffold(
navigationBar: const CupertinoNavigationBar(
middle: Text('Upgrader CupertinoApp Example'),
),
child: UpgradeAlert(
dialogStyle: UpgradeDialogStyle.cupertino,
child: const Center(child: Text('Checking...')),
),
),
);
}
```
--------------------------------
### Add dependency via Flutter CLI
Source: https://pub.dev/packages/upgrader/versions/0.11.1/install
Use this command in your terminal to automatically add the package to your project.
```bash
$ flutter pub add upgrader
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/example
Wraps the app content with UpgradeAlert to automatically check for updates. Ensure WidgetsFlutterBinding is initialized before calling Upgrader methods.
```dart
/*
* Copyright (c) 2019-2024 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Only call clearSavedSettings() during testing to reset internal values.
await Upgrader.clearSavedSettings(); // REMOVE this for release builds
// On Android, the default behavior will be to use the Google Play Store
// version of the app.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: UpgradeAlert(
child: Scaffold(
appBar: AppBar(title: const Text('Upgrader Example')),
body: const Center(child: Text('Checking...')),
),
),
);
}
}
```
--------------------------------
### Upgrader
Source: https://pub.dev/packages/upgrader
Configuration parameters for the Upgrader class which manages update logic.
```APIDOC
## Upgrader
### Description
The main class for managing app upgrade logic and store communication.
### Parameters
- **client** (http.Client) - Optional - HTTP Client for mock testing
- **clientHeaders** (Map) - Optional - HTTP headers for the client
- **countryCode** (String) - Optional - Overrides system locale country code
- **debugDisplayAlways** (bool) - Optional - Force upgrade availability (default: false)
- **debugDisplayOnce** (bool) - Optional - Display upgrade at least once (default: false)
- **debugLogging** (bool) - Optional - Enable logging (default: false)
- **durationUntilAlertAgain** (Duration) - Optional - Time until alerting user again (default: 3 days)
- **languageCode** (String) - Optional - Overrides system locale language code
- **messages** (UpgraderMessages) - Optional - Localized messages
- **minAppVersion** (String) - Optional - Minimum supported app version
- **storeController** (UpgraderStoreController) - Optional - Controller for platform store details
- **upgraderOS** (UpgraderOS) - Optional - OS information
- **willDisplayUpgrade** (Function) - Optional - Callback when upgrade display is determined
```
--------------------------------
### Configure Cupertino Style Alert
Source: https://pub.dev/packages/upgrader
Use the dialogStyle parameter to switch the alert appearance to Cupertino style.
```dart
body: UpgradeAlert(
dialogStyle: UpgradeDialogStyle.cupertino,
child: Center(child: Text('Checking...')),
)
```
--------------------------------
### Import upgrader in Dart
Source: https://pub.dev/packages/upgrader/versions/0.1.0/install
Include this import statement at the top of your Dart files to access the package functionality.
```dart
import 'package:upgrader/upgrader.dart';
```
--------------------------------
### UpgradeAlert
Source: https://pub.dev/packages/upgrader
Configuration parameters for the UpgradeAlert widget used to display update dialogs.
```APIDOC
## UpgradeAlert
### Description
A widget that displays an upgrade dialog to the user. It can be customized via various parameters.
### Parameters
- **barrierDismissible** (bool) - Optional - Indicates whether tapping on the barrier will dismiss the dialog (default: false)
- **cupertinoButtonTextStyle** (TextStyle) - Optional - Text style for cupertino dialog buttons
- **dialogStyle** (String) - Optional - Style of the dialog, 'material' or 'cupertino' (default: 'material')
- **onIgnore** (Function) - Optional - Callback when ignore button is tapped
- **onLater** (Function) - Optional - Callback when later button is tapped
- **onUpdate** (Function) - Optional - Callback when update button is tapped
- **shouldPopScope** (Function) - Optional - Determines if the dialog blocks the current route from being popped
- **showPrompt** (bool) - Optional - Show or hide Prompt label (default: true)
- **showIgnore** (bool) - Optional - Show or hide Ignore button (default: true)
- **showLater** (bool) - Optional - Show or hide Later button (default: true)
- **showReleaseNotes** (bool) - Optional - Show or hide release notes (default: true)
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader
Wrap the home widget in UpgradeAlert, ensuring it is placed below MaterialApp in the widget tree.
```dart
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Upgrader Example',
home: UpgradeAlert(
child: Scaffold(
appBar: AppBar(title: const Text('Upgrader Example')),
body: const Center(child: Text('Checking...')),
),
),
);
}
}
```
--------------------------------
### Implement Custom Language Localization
Source: https://pub.dev/packages/upgrader
Override the message function in a custom UpgraderMessages class to provide localized strings for specific keys. Fall back to super.message for keys not explicitly handled.
```dart
class MySpanishMessages extends UpgraderMessages {
/// Override the message function to provide custom language localization.
@override
String message(UpgraderMessage messageKey) {
if (languageCode == 'es') {
switch (messageKey) {
case UpgraderMessage.body:
return 'es A new version of {{appName}} is available!';
case UpgraderMessage.buttonTitleIgnore:
return 'es Ignore';
case UpgraderMessage.buttonTitleLater:
return 'es Later';
case UpgraderMessage.buttonTitleUpdate:
return 'es Update Now';
case UpgraderMessage.prompt:
return 'es Want to update?';
case UpgraderMessage.releaseNotes:
return 'es Release Notes';
case UpgraderMessage.title:
return 'es Update App?';
}
}
// Messages that are not provided above can still use the default values.
return super.message(messageKey);
}
}
UpgradeAlert(upgrader: Upgrader(messages: MySpanishMessages()));
```
--------------------------------
### UpgradeCard
Source: https://pub.dev/packages/upgrader/versions/13.5.0
Configuration parameters for the UpgradeCard widget used to display upgrade information within a card.
```APIDOC
## UpgradeCard
### Description
A widget that displays upgrade information within a card layout.
### Parameters
- **margin** (EdgeInsets) - Optional - Empty space surrounding the card. Defaults to null.
- **maxLines** (int) - Optional - Maximum number of lines for the text to span. Defaults to 15.
- **onIgnore** (Function) - Optional - Callback when the ignore button is tapped.
- **onLater** (Function) - Optional - Callback when the later button is tapped.
- **onUpdate** (Function) - Optional - Callback when the update button is tapped.
- **overflow** (TextOverflow) - Optional - How visual overflow should be handled. Defaults to TextOverflow.ellipsis.
- **showPrompt** (bool) - Optional - Hide or show Prompt label. Defaults to true.
- **showIgnore** (bool) - Optional - Hide or show Ignore button. Defaults to true.
- **showLater** (bool) - Optional - Hide or show Later button. Defaults to true.
- **showReleaseNotes** (bool) - Optional - Hide or show release notes. Defaults to true.
```
--------------------------------
### Add upgrader to pubspec.yaml
Source: https://pub.dev/packages/upgrader/install
Manually add the dependency to your pubspec.yaml file to include the package in your project.
```yaml
dependencies:
upgrader: ^13.5.0
```
--------------------------------
### Implement UpgradeAlert in Flutter
Source: https://pub.dev/packages/upgrader/versions/3.10.0/example
Use the UpgradeAlert widget to automatically check for updates. Clear saved settings only during testing to ensure the prompt appears as expected.
```dart
/*
* Copyright (c) 2019 Larry Aasen. All rights reserved.
*/
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
MyApp({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
// Only call clearSavedSettings() during testing to reset internal values.
Upgrader().clearSavedSettings(); // REMOVE this for release builds
// On Android, the default behavior will be to use the Google Play Store
// version of the app.
// On iOS, the default behavior will be to use the App Store version of
// the app, so update the Bundle Identifier in example/ios/Runner with a
// valid identifier already in the App Store.
return MaterialApp(
title: 'Upgrader Example',
home: Scaffold(
appBar: AppBar(
title: Text('Upgrader Example'),
),
body: UpgradeAlert(
debugLogging: true,
child: Center(child: Text('Checking...')),
)),
);
}
}
```
--------------------------------
### UpgradeCard
Source: https://pub.dev/packages/upgrader
Configuration parameters for the UpgradeCard widget used to display update information within a card.
```APIDOC
## UpgradeCard
### Description
A widget that displays upgrade information inside a card.
### Parameters
- **margin** (EdgeInsets) - Optional - Empty space surrounding the card
- **maxLines** (int) - Optional - Maximum number of lines for text (default: 15)
- **onIgnore** (Function) - Optional - Callback when ignore button is tapped
- **onLater** (Function) - Optional - Callback when later button is tapped
- **onUpdate** (Function) - Optional - Callback when update button is tapped
- **overflow** (TextOverflow) - Optional - Visual overflow handling (default: TextOverflow.ellipsis)
- **showPrompt** (bool) - Optional - Show or hide Prompt label (default: true)
- **showIgnore** (bool) - Optional - Show or hide Ignore button (default: true)
- **showLater** (bool) - Optional - Show or hide Later button (default: true)
- **showReleaseNotes** (bool) - Optional - Show or hide release notes (default: true)
```
--------------------------------
### Upgrade Major Package Versions
Source: https://pub.dev/packages/upgrader/versions/11.5.1/score
Use these commands to update the version constraints in your pubspec.yaml file for specific packages.
```bash
dart pub upgrade --major-versions device_info_plus
```
```bash
dart pub upgrade --major-versions package_info_plus
```
--------------------------------
### Reset Upgrader Settings
Source: https://pub.dev/packages/upgrader
Clears saved settings to reset the state of ignored or later prompts during development.
```dart
await Upgrader.clearSavedSettings();
```
--------------------------------
### ITunesSearchAPI.lookupByBundleId
Source: https://pub.dev/packages/upgrader
Queries the iTunes Search API for application details using a specific bundle ID.
```APIDOC
## lookupByBundleId(bundleId)
### Description
Retrieves application metadata from the iTunes Search API for a given bundle identifier.
### Parameters
- **bundleId** (String) - Required - The unique bundle identifier of the application (e.g., 'com.google.Maps').
### Example
```dart
final iTunes = ITunesSearchAPI();
final resultsFuture = iTunes.lookupByBundleId('com.google.Maps');
resultsFuture.then((results) {
print('results: $results');
});
```
```
--------------------------------
### Enable Android Back Button Dismissal
Source: https://pub.dev/packages/upgrader
Configure the shouldPopScope callback to return true to allow the Android back button to dismiss the UpgradeAlert dialog.
```dart
UpgradeAlert(shouldPopScope: () => true);
```
--------------------------------
### Add upgrader dependency to pubspec.yaml
Source: https://pub.dev/packages/upgrader/versions/0.1.0/install
Manually add this line to the dependencies section of your pubspec.yaml file.
```yaml
dependencies:
upgrader: ^0.1.0
```
--------------------------------
### Add dependency to pubspec.yaml
Source: https://pub.dev/packages/upgrader/versions/0.10.0/install
Manually add the package version to the dependencies section of your configuration file.
```yaml
dependencies:
upgrader: ^0.10.0
```
--------------------------------
### Customize Upgrader UI Strings
Source: https://pub.dev/packages/upgrader
Extend UpgraderMessages to override specific button titles or labels. Pass an instance of the custom class to the messages parameter of UpgradeAlert or UpgradeCard.
```dart
class MyUpgraderMessages extends UpgraderMessages {
@override
String get buttonTitleIgnore => 'My Ignore';
}
UpgradeAlert(Upgrader(messages: MyUpgraderMessages()));
```
--------------------------------
### Force a Specific Language Code
Source: https://pub.dev/packages/upgrader
Override the system language by passing a specific language code to the UpgraderMessages constructor.
```dart
UpgradeAlert(upgrader: Upgrader(messages: UpgraderMessages(code: 'es')));
```
--------------------------------
### Static Analysis Deprecated ButtonBar Usage
Source: https://pub.dev/packages/upgrader/versions/9.0.0/score
Highlights the use of the deprecated ButtonBar widget in alert_style_widget.dart, recommending a migration to OverflowBar.
```text
╷
21 │ /// These widgets will be wrapped in a [ButtonBar], which introduces 8 pixels
│ ^^^^^^^^^
╵
```
--------------------------------
### Static Analysis Unreachable Default Case
Source: https://pub.dev/packages/upgrader/versions/9.0.0/score
Identifies an unreachable default clause in the switch statement within upgrade_messages.dart.
```text
╷
80 │ default:
│ ^^^^^^^
╵
```
--------------------------------
### Define Critical Update in Appcast
Source: https://pub.dev/packages/upgrader
Forces an update by adding the sparkle:criticalUpdate tag to an item in the Appcast XML.
```xml
-
Version 1.15.0
...
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.