verifyBlock method

void verifyBlock(
  1. Map<String, dynamic>? blockAttributes
)

Implementation

void verifyBlock(Map<String, dynamic>? blockAttributes) {
  final int? indent = blockAttributes?['indent'];
  if (blockAttributes?['list'] != null) {
    if (indent != null) {
      // validate if the last indent is different that the current one
      //
      // if it is, then must reload the specific index counter to avoid generate
      // a bad index for the current item
      if (lastListIndent != indent) {
        if (indent == 1) numberIndent1List = 0;
        if (indent == 2) numberIndent2List = 0;
        if (indent == 3) numberIndent3List = 0;
        if (indent == 4) numberIndent4List = 0;
        if (indent == 5) numberIndent5List = 0;
      }
      lastListIndent = indent;
      if (indent == 1) numberIndent1List++;
      if (indent == 2) numberIndent2List++;
      if (indent == 3) numberIndent3List++;
      if (indent == 4) numberIndent4List++;
      if (indent == 5) numberIndent5List++;
    } else {
      lastListIndent = 0;
      numberList++;
    }
  } else {
    lastListIndent = 0;
    numberList = 0;
    numberIndent1List = 0;
    numberIndent2List = 0;
    numberIndent3List = 0;
    numberIndent4List = 0;
    numberIndent5List = 0;
  }
  blockAttributes?['code-block'] != null ? numCodeLine++ : numCodeLine = 0;
}