asInt function

int asInt(
  1. Map<String, dynamic>? json,
  2. String key, {
  3. int fallback = 0,
})

Convert any map value with key to int or fallback safely. If fallback is not provided, it defaults to 0.

Implementation

int asInt(Map<String, dynamic>? json, String key, {int fallback = 0}) {
  return toInt(
      asTOrNull(
        json,
        key,
      ),
      fallback: fallback);
}