getPartsByTex method

List<SingleStringMathTex> getPartsByTex(
  1. String tex, {
  2. bool substring = true,
  3. bool caseSensitive = true,
})

Implementation

List<SingleStringMathTex> getPartsByTex(String tex,
    {bool substring = true, bool caseSensitive = true}) {
  var test = (String tex1, String tex2) {
    if (!caseSensitive) {
      tex1 = tex1.toLowerCase();
      tex2 = tex2.toLowerCase();
    }

    if (substring) {
      return tex2.contains(tex1);
    } else {
      return tex1 == tex2;
    }
  };

  return [
    for (var m in submobjects)
      if (m is SingleStringMathTex && test(tex, m.getTexString())) m
  ];
}