Example

Code block with syntax highlighting and copy functionality displaying JSON data.
Properties
Required
String
required
The code content to display with syntax highlighting.
Content
String
default:"dart"
The programming language for syntax highlighting. Supports common languages like ‘json’, ‘javascript’, ‘typescript’, ‘python’, ‘yaml’, etc.
Best Practices
- Width Constraints: Always provide width constraints to prevent layout issues by wrapping in
ConstrainedBox,SizedBox,Expanded, etc. - Code Formatting: Use proper indentation and formatting in your code strings for better readability.
Integration Notes
- Copy Functionality: The copy button automatically copies the entire code content to the system clipboard.
- Text Selection: Users can manually select and copy portions of the code using standard text selection gestures.
- Loading States: Shows a loading indicator while the syntax highlighter initializes.


