Browse Source

[package_info_plus] remove exec

merge-requests/3/head
Vitaliy Zarubin 2 years ago
parent
commit
0377330d03
  1. 4
      packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml
  2. 29
      packages/package_info_plus/package_info_plus_aurora/example/lib/main.dart
  3. 12
      packages/package_info_plus/package_info_plus_aurora/lib/package_info_plus_aurora.dart

4
packages/flutter_local_notifications/flutter_local_notifications_aurora/pubspec.yaml

@ -13,6 +13,10 @@ dependencies:
dbus: ^0.7.8
plugin_platform_interface: ^2.0.2
flutter_local_notifications_platform_interface: ^7.0.0
package_info_plus: 4.0.0
package_info_plus_aurora:
path: ../../package_info_plus/package_info_plus_aurora
dev_dependencies:
flutter_test:

29
packages/package_info_plus/package_info_plus_aurora/example/lib/main.dart

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
void main() {
@ -19,8 +18,6 @@ class _MyAppState extends State<MyApp> {
String? _error;
String? _appName;
String? _packageName;
String? _version;
String? _buildNumber;
@override
void initState() {
@ -34,15 +31,11 @@ class _MyAppState extends State<MyApp> {
String appName = packageInfo.appName;
String packageName = packageInfo.packageName;
String version = packageInfo.version;
String buildNumber = packageInfo.buildNumber;
// Update state variable
setState(() {
_appName = appName;
_packageName = packageName;
_version = version;
_buildNumber = buildNumber;
});
} on Exception catch (e) {
setState(() {
@ -132,28 +125,6 @@ class _MyAppState extends State<MyApp> {
_packageName ?? 'Not found.',
style: textStylePath,
),
spaceMedium,
const Text(
'Version',
style: textStyleTitle,
),
spaceSmall,
Text(
_version ?? 'Not found.',
style: textStylePath,
),
spaceMedium,
const Text(
'Build Number',
style: textStyleTitle,
),
spaceSmall,
Text(
_buildNumber ?? 'Not found.',
style: textStylePath,
),
],
),
),

12
packages/package_info_plus/package_info_plus_aurora/lib/package_info_plus_aurora.dart

@ -37,18 +37,16 @@ class PackageInfoPlusAurora extends PackageInfoPlatform {
.readAsLines())
.where((element) => element.contains('Name='));
// @todo
// Get application versions
final result = (await Process.run('rpm',
['-q', '--queryformat', '%{VERSION}\n%{RELEASE}', packageName]))
.stdout
.toString()
.split('\n');
// rpm -q --queryformat %{VERSION} <package>
// not working even with Compatibility permission
return <String, dynamic>{
'app_name': desktop.isNotEmpty ? desktop.first.substring(5) : null,
'package_name': packageName,
'version': result[0],
'build_number': result[1],
'version': '',
'build_number': '',
};
} catch (e) {
debugPrint(e.toString());

Loading…
Cancel
Save