A maze generation algorithm which creates a maze with at least one solution and can be scaled to any size.
I took the explanation of the algorithm here and wrote the equivalent in Dart.
The following is some sample output for a 10 x 20 maze:
| | | _ _ | |
| |_ _| | _ _| | |
| | | | |_ | | |_|
| _|_ _ | _ _|
|_ | _ _ | | |
|_ | _|_| |_ | |
| | | | | | | | |_| |
|_ _ _ _ _| | | |
| | _ |_ | | |
|_| |_| |_| | |
| | _ _|_|_| |_|
| | _|_| |_ | |
|_ _ _| | | | |_|_|
| |_ | |_ _ _ _ |
| | _| _ |
| |_| _ _ | |
| | | _|_| |_|_|_| |
| |_ _| | _|
| |_ | |_ |_ | |
| | | | |_ _ _ _ |
You can generate infinitely long mazes by simply generating the next row as needed. This can be used with Flutter's ListView.builder method where the length is not specified. See the tileBuilder method example script.