readBlockType method

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

Implementation

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