fbmobile/lib/core/viewmodels/about_model.dart

33 lines
771 B
Dart
Raw Normal View History

import 'package:package_info_plus/package_info_plus.dart';
2021-02-02 14:33:23 +00:00
import '../../core/services/link_service.dart';
import '../../locator.dart';
import '../enums/viewstate.dart';
2021-02-02 14:33:23 +00:00
import 'base_model.dart';
class AboutModel extends BaseModel {
final LinkService _linkService = locator<LinkService>();
PackageInfo packageInfo = PackageInfo(
appName: 'Unknown',
packageName: 'Unknown',
version: 'Unknown',
buildNumber: 'Unknown',
);
void init() async {
await _initPackageInfo();
}
Future<void> _initPackageInfo() async {
2023-01-04 20:17:54 +00:00
setStateView(ViewState.busy);
final PackageInfo info = await PackageInfo.fromPlatform();
packageInfo = info;
2023-01-04 20:17:54 +00:00
setStateView(ViewState.idle);
}
2021-02-02 14:33:23 +00:00
void openLink(String link) {
_linkService.open(link);
}
}