Я хочу показать диалог для пользователя, когда новая версия приложения доступна в магазине игр или Google Play, для этого я использовал пакет Upgrader от флаттера. Этот пакет использует класс «AppCast». код:
import 'package:flutter/material.dart';
import 'package:upgrader/upgrader.dart';
import 'package:store_redirect/store_redirect.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,
showIgnore : false,
showLater : false,
dialogStyle :UpgradeDialogStyle.cupertino,
onUpdate :(){
_ launchURL();
return true;
},
child: Center(child: Text('Checking...')),
)),
);
}
_launchURL() async {
StoreRedirect.redirect(
androidAppId: "intersoft.pos.soft_ta",
iOSAppId: "284882215");
}
}
в примере appcastURL 'https://raw.githubusercontent.com/larryaasen/upgrader/master/test/testappcast.xml' как я могу получить правильный файл .xml для моего приложения?
Я прочитал документацию по классу appcast, но не понимаю, что мне делать.





Я нашел еще один пакет под названием new_version он очень простой и понятный, никаких дополнительных шагов или настроек не нужно.
Создайте новый файл appcast.xml
Вставьте это в него
<?xml version = "1.0" encoding = "utf-8"?>
<rss version = "2.0" xmlns:sparkle = "http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>Help Code TJCODE- Appcast</title>
<item>
<title>Version 1.15.0</title>
<description>desc</description>
<pubDate>Tue, 08 Jun 2021 12:00:00 +0000</pubDate>
<enclosure url = "https://play.google.com/store/apps/details?id=com.example.app" sparkle:version = "1.0.0" sparkle:os = "android" />
</item>
</channel>
</rss>
Отредактируйте данные в этом файле, чтобы они соответствовали вашей собственной конфигурации приложения.
Разместите этот файл в доступном месте. Вы можете разместить его на Github.
Создайте xml-файл и вставьте его внутрь <?xml version = "1.0" encoding = "utf-8"?> <rss version = "2.0" xmlns:sparkle = "andymatuschak.org/xml-namespaces/sparkle "> <channel> <title>Код справки TJCODE-Appcast</title> <item> <title>Версия 1.15.0</title> <description>desc</description> <pubDate>Вторник, 08 июня 2021 г., 12:00:00 +0000</pubDate> <enclosure url = " play.google.com/store/apps/details?id=com.example.app" sparkle:version = "1.0.0" sparkle:os = "android" /> </item> </канал> </rss>