'Is there any C code formatter/beautify for Dart Flutter project?

I am developing my personal flutter app for my university work. Now I'm facing a problem. Problem is I'm not finding any C code formatter or even how to do that in my app.

In my app I have a feature for posting a code on my university VPL page. I post code on VPL before code properly formatted code, like we do on VScode. Same as want in my app, just touching on format code button and then code just formatted.

Simple screenshot of my app



Solution 1:[1]

A code formatter is created by parsing the text and in your case C code. There isn't a package which parses your C code in your app because they are really hard to create. You could use an online api to format your code if such a tool exists.

Also instead of using a Textfield for your code section, you can look into the code_text_field package as it has syntax highlighting and basically a code editor inside your flutter application.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vraj Shah