flutter_md
0.3.1, released 3 weeks ago by plugfox.dev
Fast Markdown parser and canvas renderer for Flutter with text selection and streaming.
What it does
Parses and renders Markdown text on a Flutter canvas with custom render objects. Supports cross-widget text selection, streaming parsing for LLM token outputs, and opt-in syntax highlighting.
AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Displaying markdown text from AI assistants like ChatGPT and Gemini
- Streaming markdown content token by token into chat interfaces
- Requiring robust cross-block and cross-widget text selection for markdown
Skip it when
- You only need to display plain non-markdown text
- You do not need custom canvas-rendered markdown features
Strengths
- High performance parser and renderer with optimized streaming support
- Cross-block and cross-widget text selection surviving list disposals
- Dependency-free code-block syntax highlighting with 65+ languages
Weaknesses
- API updates between minor versions may require adjustments for custom painters or selection surfaces
- Advanced customizations require understanding custom render objects and specialized scopes
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
No native platform steps or permissions required.
import 'package:flutter/material.dart';
import 'package:flutter_md/flutter_md.dart';
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
const ExampleApp({super.key});
static final Markdown _markdown = Markdown.fromString('''
# Hello, **flutter_md**
A paragraph with *emphasis*, `inline code` and a
[link](https://pub.dev/packages/flutter_md).
''');
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
body: SafeArea(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: MarkdownWidget(markdown: _markdown),
),
),
),
);
}Alternatives
Packages that do the same job and could replace flutter_md.
- gpt_markdown
Powerful Flutter Markdown and LaTeX renderer built for AI streaming outputs.
94Compare - re_highlight
Powerful text syntax highlighting library translated from highlightjs.
50Compare - selectable
A widget that enables text selection across multiple text widgets.
77Compare - re_editor
A lightweight text and code editor widget for Flutter with syntax highlighting and folding.
80Compare