Skip to content
pubscout

flutter_json

0.2.0, released 3 months ago by sevdev.at

Renders valid JSON as an interactive hierarchical tree structure with lazy loading.

WASM-readyUses material_ui
$ flutter pub add flutter_json
Source repository

What it does

Flutter JSON allows you to beautifully render any valid JSON as an interactive hierarchical tree structure in your app. It supports lazy rendering of children for improved performance and offers extensive customization options for styling and appearance.

AI-written summary of version 0.2.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to inspect or display JSON data hierarchically within your Flutter app UI.
  • You are dealing with large JSON structures up to 25 MB and require lazy rendering for performance.

Skip it when

  • You do not have a bounded height available for the widget.
  • You need custom non-fixed-width horizontal scrolling constraints.

Strengths

  • Supports rendering any valid JSON data structures.
  • Lazily renders tree structures for improved performance with large JSON payloads.
  • Offers extensive customization for styling, appearance, icons, and hidden keys.

Weaknesses

  • Requires a bounded height due to lazy loading limitations.
  • Forces fixed-width constraints for nodes to allow horizontal scrolling.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2
import 'package:flutter_json/flutter_json.dart';

const String jsonString = '{ "foo": "bar", "baz": [1, 2, 3] }';

class MyPage extends StatelessWidget {
  const MyPage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("JSON Example"),
      ),
      body: JsonWidget(
        json: json.decode(jsonString),
        initialExpandDepth: 2,
        hiddenKeys: const ["foo"],
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace flutter_json.

Works with

Packages commonly used together with flutter_json: ones it builds on, ones built on it, and its own family.