Spec-Zone.ru › Dart 1

dart:core

Конструктор int.fromEnvironment const

const int.fromEnvironment(String name, { int defaultValue })

Возвращает целое значение заданного объявления среды name.

Результат совпадает с тем, что возвращается:

int.parse(const String.fromEnvironment(name, defaultValue: ""),
          (_) => defaultValue)

Пример:

const int.fromEnvironment("defaultPort", defaultValue: 80)

Исходный код

// The .fromEnvironment() constructors are special in that we do not want
// users to call them using "new". We prohibit that by giving them bodies
// that throw, even though const constructors are not allowed to have bodies.
// Disable those static errors.
//ignore: const_constructor_with_body
//ignore: const_factory
external const factory int.fromEnvironment(String name, {int defaultValue});

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/int/int.fromEnvironment.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API