diff --git a/CHANGELOG.md b/CHANGELOG.md index 031c22f24cd..d20994dddc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ * `dart:convert` * `Base64Decoder.convert` now takes optional `start` and `end` parameters. +* `dart:io` + * `Platform` added an `isiOS` getter and `Platform.operatingSystem` may now + return `ios`. + ## 1.13.0 ### Core library changes diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc index 091d093feda..0f7c62965c2 100644 --- a/runtime/bin/platform_macos.cc +++ b/runtime/bin/platform_macos.cc @@ -53,7 +53,11 @@ int Platform::NumberOfProcessors() { const char* Platform::OperatingSystem() { +#if TARGET_OS_IOS + return "ios"; +#else return "macos"; +#endif } diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc index aa6b9c855fe..1a338f49fcb 100644 --- a/runtime/vm/os_macos.cc +++ b/runtime/vm/os_macos.cc @@ -27,7 +27,11 @@ namespace dart { const char* OS::Name() { +#if TARGET_OS_IOS + return "ios"; +#else return "macos"; +#endif } diff --git a/sdk/lib/io/platform.dart b/sdk/lib/io/platform.dart index 56ddea0193b..c9e1cc66d6d 100644 --- a/sdk/lib/io/platform.dart +++ b/sdk/lib/io/platform.dart @@ -84,7 +84,7 @@ class Platform { static String get pathSeparator => _pathSeparator; /** - * Get a string (`linux`, `macos`, `windows` or `android`) + * Get a string (`linux`, `macos`, `windows`, `android`, or `ios`) * representing the operating system. */ static String get operatingSystem => _operatingSystem; @@ -114,6 +114,11 @@ class Platform { */ static final bool isAndroid = (_operatingSystem == "android"); + /** + * Returns true if the operating system is iOS. + */ + static final bool isiOS = (_operatingSystem == "ios"); + /** * Get the environment for this process. *