Introduction to the fluent platform

__ white 2021-08-08 18:41:11
introduction fluent platform


This is my participation 8 The fourth of the yuegengwen challenge 8 God , Check out the activity details :8 Yuegengwen challenge

#Platform stay dart:io in , Provide with Platform Class API Parity check , But use instance properties instead of static properties . This difference allows these to be used in the test API, You can provide a simulation implementation in it .

Take a look at the construction method :

class Platform {
static int get numberOfProcessors => _numberOfProcessors;
static String get pathSeparator => _pathSeparator;
static String get localeName => _Platform.localeName();
static String get operatingSystem => _operatingSystem;
static String get operatingSystemVersion => _operatingSystemVersion;
static String get localHostname => _localHostname;
static final bool isLinux = (_operatingSystem == "linux");
static final bool isMacOS = (_operatingSystem == "macos");
static final bool isWindows = (_operatingSystem == "windows");
static final bool isAndroid = (_operatingSystem == "android");
static final bool isIOS = (_operatingSystem == "ios");
static final bool isFuchsia = (_operatingSystem == "fuchsia");
static Map<String, String> get environment => _Platform.environment;
static String get executable => _Platform.executable;
static String get resolvedExecutable => _Platform.resolvedExecutable;
static Uri get script => _Platform.script;
static List<String> get executableArguments => _Platform.executableArguments;
static String get packageRoot => _Platform.packageRoot;
static String get packageConfig => _Platform.packageConfig;
static String get version => _version;
}
 Copy code 

We can see that there are still many methods , Next, we will mainly introduce the usage method and the meaning of each attribute .

## Usage method

###1. Bring in the package first :

import 'dart:io';

2. Use :

Platform.isAndroid Platform.operatingSystem The use of other attributes is the same as above .

###3 for example :

 void _btnPress() {
print(Platform.isAndroid); // true/false
}
 Copy code 

If your phone is Android , It will print on the console true, Or print it out false.

##API The following is based on Nexus5X API 28 test

table th:second-of-type {width: 100px;}
attribute type Local printing results describe
numberOfProcessors int 4 Number of each execution unit of the machine .
pathSeparator String / The path separator used by the operating system to separate components in the file path .
localeName String en_US Gets the name of the current locale .
operatingSystem String android A string representing the operating system or platform .
operatingSystemVersion String Linux 4.4.124+ #1 SMP PREEMPT Mon Jun 18 17:10:07 UTC 2018 A string representing the operating system or platform version .
localHostname String localhost Local host name of the system
isLinux bool false Whether the operating system is [Linux] Version of
isMacOS bool false Whether the operating system is [macOS] Version of
isWindows bool false Whether the operating system is [Windows] Version of
isAndroid bool true Whether the operating system is [Android] Version of
isIOS bool false Whether the operating system is [IOS] Version of
isFuchsia bool false Whether the operating system is [Fuchsia] Version of
environment Map< String, String > {PATH:/sbin:/system/sbin:/system/bin:/s } .. Wait a long string .. The environment for this process is the mapping from string keys to string values . Mapping is not modifiable , Its contents are retrieved from the operating system on first use .Windows Environment variables on are case insensitive , So in Windows On , Mapping is not case sensitive , And convert all keys to uppercase . On other platforms , You can use case sensitive keys .
executable String /system/bin/app_process32 The path to the executable used to run the script in this isolation . The text path used to identify the script . This path may be relative , Or just search the system path to find the name of the executable . Use [resolvedExecutable] Get the absolute path of the executable .
resolvedExecutable String /system/bin/app_process32 After the operating system is parsed , The path to the executable used to run the script in this isolation . This is the absolute path to resolve all symbolic links , Executable file used to run the script .
script Uri file:///main.dart The absolute number of scripts to run in this quarantine URI. If the executable environment does not support ( Script ),uri It's empty
executableArguments List< String > [] The flag passed to the executable by running the script in this isolation area . These are the command line flags of the executable before the script name . A new list is provided each time the value is read .
packageRoot String null --package-root Flag passed to executable , Used to run scripts in this quarantine . without --package-root sign , Then for null
packageConfig String null --package Flag passed to executable , Used to run scripts in this quarantine . without --package sign , Then for null
version String 2.0.0-dev.58.0.flutter-f981f09760 (Sat May 26 03:16:14 2018 +0000) on "android_ia32" At present DART The version of the runtime .
版权声明
本文为[__ white]所创,转载请带上原文链接,感谢
https://qdmana.com/2021/08/20210808183744935d.html

  1. css单位
  2. CSS unit
  3. 前端验证集合
  4. Front end validation collection
  5. Front end learning (4) -- response line, response head, response body
  6. Lesson 27: using time measuring tools to explore available spare time
  7. CSS 单位
  8. CSS unit
  9. 前端工具集合
  10. Front end Tools Collection
  11. Introduction to HTTP message format
  12. Introduction to new features of HTML5
  13. Common instructions for Vue
  14. Introduction of bootstrap Blazer component library
  15. HTML5 速览
  16. HTML5 quick view
  17. HTML表格自动排序
  18. For less than $1700, create a private cloud with openstack
  19. Basic learning of JavaScript (1)
  20. 前端编程之路一一HTML标签分类
  21. Front end Programming: HTML tag classification
  22. ColSpan and rowspan merging cells of HTML form elements
  23. JavaScript 日期时间格式化
  24. JavaScript date time formatting
  25. Classification of front end interview questions - html2
  26. CSS block elements
  27. HTML5 form detailed tutorial
  28. HTML5 form detailed tutorial
  29. HTML5新增的元素表
  30. New element table in HTML5
  31. 3D轮播插件vue-carousel-3d非官方最全文档
  32. 3D carousel plug-in vue-carousel-3d
  33. Uniapp (Vue general) integrates Tencent location service SDK -- multi platform small program general
  34. Slowhttptest slow attack tool use details
  35. HTML summary (2)
  36. Overview of CSS3
  37. Front end abnormal monitoring system
  38. 免费网站部署和免费数据库Serverless云存储资源汇总整理
  39. Free website deployment and collection of free database serverless cloud storage resources
  40. Vux form -- a form solution of base vux
  41. 可以直接用于HTML中的特殊字符表 unicode字符集
  42. Can be directly used in HTML special character table Unicode character set
  43. Detailed explanation of HTTP protocol
  44. HTTP request header and request response header
  45. CSS background深度解析
  46. Python web/HTML GUI
  47. Front end standard 2: HTML you know and don't know
  48. Some HTML tags
  49. HTML标签之table
  50. Table of HTML tag
  51. DataTables of jQuery plug-in
  52. Unity calls Google's free translation API (HTTPS interface). Young people don't speak martial arts. How can they speak in multiple languages
  53. Linux entry most commonly used commands, do not learn a bunch of useless commands
  54. Piziheng embedded: a list of common short-range wireless communication protocols (Wi Fi / Bluetooth / ZigBee / thread...)
  55. Naming rules for the front end team of ladder
  56. HTML logo related symbols
  57. Node . JS: development resources and technology stack arrangement
  58. Unity calls Google's free translation API (HTTPS interface). Young people don't speak martial arts. How can they speak in multiple languages
  59. Straighten out JavaScript (18) - statements and operators
  60. Employment information statistics network (interface document)