readBlockType method

int readBlockType(
  1. Map<String, int> blockTypes
)

Implementation

int readBlockType(Map<String, int> blockTypes) {
  dynamic next = _peek();
  if (next is Map) {
    dynamic c = context.first;
    if (c is Map) {
      return blockTypes[nextKey]!;
    } else if (c is List) {
      // Objects are serialized with "type" property.
      return blockTypes[next['type']]!;
    }
  } else if (next is List) {
    // Arrays are serialized as "type": [Array].
    return blockTypes[nextKey]!;
  }
  // Unknown type.
  return 0;
}