firebasealgorithmflutterdarttext-recognition

how to firebase ml vision storing each line to a variable


I'm currently trying to learn flutter and implement OCR with firebase ml vision, but currently I want to store the text read to a variable, what's the suggested approach? For example I have a paper with

NAME

INFORMATION

Can I read the first line and store as String variable name and second line as information? How should I implement my for loop here? Let's say I already imported the libraries, and I'm stuck here.

for (TextBlock block in visionText.blocks) {
  for(n=0; n<block.lines.length; n++ )
    {
      name = 
      info =
    }
}

Thanks in advance


Solution

  • In your scenario, assuming both name and information take one line each, I would do it the first way:

        for (TextBlock block in visionText.blocks) {
          name = block.lines[0];
          info = block.lines[1];
        }