getInt method

int getInt(
  1. String name, {
  2. int? fallback,
})

Load the enviroment variable value as an int

If variable with name does not exist then fallback will be used. However if also no fallback is supplied an error will occur.

Furthermore an FormatException will be thrown if the variable with name exists but can not be parsed as an int.

Implementation

int getInt(String name, {int? fallback}) {
  final value = maybeGet(name);
  assert(value != null || fallback != null,
      'A non-null fallback is required for missing entries');
  return value != null ? int.parse(value) : fallback!;
}