Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- Flutter 앱 배포
- Flutter 예제
- ListView.builder
- WillPopScope
- Flutter 강좌
- Hello World
- Load Image
- Snackbar
- 반석천
- Row Widget
- Row
- Flutter Tutorial
- AppBar
- Column Widget
- listview
- ListTile
- sqlite
- Flutter Example
- navigator
- FutureBuilder
- Networking
- HTTP
- MainAxisAlignment
- CrossAxisAlignment
- flutter
- Cached Image
- Scaffold
- node.js
- Image.network
- InkWell
Archives
- Today
- Total
꿈꾸는 시스템 디자이너
Flutter Example - How to get app information | App Name, App ID, Version, BuildNumber | package_info plugin 본문
Tutorial/Flutter with App
Flutter Example - How to get app information | App Name, App ID, Version, BuildNumber | package_info plugin
독행소년 2019. 10. 17. 13:46* About Plugin
https://pub.dev/packages/package_info
1. Add this to pubspec.yaml file
dependencies:
package_info: ^0.4.0+6
2. Source Code
import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';
AppInfoDemoState pageState;
class AppInfoDemo extends StatefulWidget {
@override
AppInfoDemoState createState() {
pageState = AppInfoDemoState();
return pageState;
}
}
class AppInfoDemoState extends State<AppInfoDemo> {
String appName = "";
String appID = "";
String version = "";
String buildNumber = "";
@override
void initState() {
super.initState();
getAppInfo();
}
void getAppInfo() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
setState(() {
appName = packageInfo.appName;
appID = packageInfo.packageName;
version = packageInfo.version;
buildNumber = packageInfo.buildNumber;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("App Infomation")),
body: ListView(
children: <Widget>[
Card(
child: ListTile(
title: Text("App Name"),
subtitle: Text(appName),
),
),
Card(
child: ListTile(
title: Text("Package Name (AppID)"),
subtitle: Text(appID),
),
),
Card(
child: ListTile(
title: Text("Version"),
subtitle: Text(version),
),
),
Card(
child: ListTile(
title: Text("Build Number"),
subtitle: Text(buildNumber),
),
),
],
),
);
}
}
▶ Go to Table of Contents | 강의 목차로 이동
※ This example is also available in the Flutter Code Examples app. | 본 예제는 Flutter Code Examples 앱에서도 제공됩니다.
'Tutorial > Flutter with App' 카테고리의 다른 글
Flutter Example - Request App Review | app_review plugin (0) | 2019.10.17 |
---|---|
Flutter Example - Sending simple data to other apps | flutter_share plugin (0) | 2019.10.17 |
Flutter Example - SQLite | How to use SQL Helper (1) | 2019.10.16 |
Flutter Example - SQLite | Raw SQL Queries (0) | 2019.10.16 |
Flutter Example - Parse Json Data (0) | 2019.10.14 |
Comments