flutter_sanity_portable_text
2.3.0, released 9 days ago by vyuh.tech
Flutter renderer for Sanity.io Portable Text format with block, span, and style support.
What it does
Renders Sanity.io Portable Text format content inside Flutter applications. Supports standard and custom blocks, spans, annotations, and styles with helpful inline error messages for unregistered elements.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to render Sanity CMS portable text content in a Flutter application.
- You want custom block and custom mark support for rich text rendering.
Skip it when
- You are not using Sanity.io as your backend CMS.
- You only need to render basic Markdown or HTML strings.
Strengths
- Complete support for standard Portable Text styles and marks.
- Extensible architecture for custom blocks, custom marks, and custom list builders.
- Developer-friendly error handling for unregistered elements.
Weaknesses
- Tied specifically to the Sanity.io Portable Text format.
- FSL-1.1-MIT license requires attention regarding commercial terms.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 4
Add the package to pubspec.yaml and register any custom blocks or mark definitions if needed.
import 'package:flutter/material.dart';
import 'package:flutter_sanity_portable_text/flutter_sanity_portable_text.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: PortableText(
blocks: [
TextBlockItem(
children: [
Span(
text: 'Sanity Portable Text',
),
],
style: 'h1',
),
],
),
),
);
}
}Alternatives
Packages that do the same job and could replace flutter_sanity_portable_text.
- liquid_glass_renderer
iOS 27-style liquid glass renderer for Flutter with refraction, frost, and tint.
87Compare - v_chat_bubbles
A comprehensive Flutter chat bubble library supporting Telegram, WhatsApp, Messenger, and iMessage styles.
63Compare - cupertino_onboarding
Provides an iOS-style onboarding experience with Flutter widgets.
50Compare
Works with
Packages commonly used together with flutter_sanity_portable_text: ones it builds on, ones built on it, and its own family.
- json_annotationflutter_sanity_portable_text depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- material_uiflutter_sanity_portable_text depends on itOfficial Flutter Material UI library implementing Google’s Material Design system.
- nanoidflutter_sanity_portable_text depends on itA tiny, secure, URL-friendly, unique string ID generator.
- sanity_clientSame familyDart client for Sanity.io with GROQ queries and live updates