This is a simple class to package up and send requests to the Kroki.io web service.

Last update: Jun 8, 2022

Kroki.dart

Pub pub points popularity likes License

GitHub contributors GitHub forks GitHub stars

This is a simple class to package up and send requests to the Kroki.io web service.

A live editor to editing diagrams that Kroki supports can be found at niolesk.top

Features and bugs

Please file feature requests and bugs at the issue tracker.


Example with package:markdown

Here is an example of using the Kroki package with package:markdown to support fenced code blocks that contain diagrams.

import 'package:kroki/kroki.dart';
import 'package:markdown/markdown.dart' as markdown;

final Kroki kroki = Kroki();

class DiagramTransfomer extends markdown.CodeBlockTransformer {
  @override
  markdown.Node? transformCodeBlock(
      String codeBlockType, String rawCodeBlock, markdown.BlockParser parser) {
    final markdown.AsyncText asyncText = markdown.AsyncText(
        kroki.convertDiagram(codeBlockType, rawCodeBlock), parser,
        uncompletedFutureTextValue:
            rawCodeBlock // fall back to showing diagram source
        );
    return asyncText;
  }

  DiagramTransfomer() :
    super(handledCodeBlockTypes:KrokiDiagramEndpoints.supportedEndpoints);
}

final diagramTransformingFencedCodeBlock =
    markdown.TransformableFencedCodeBlockSyntax([DiagramTransfomer()]);

main() {
    final finalHtml = await markdown.markdownToHtmlWithAsyncTransforms(markdownSource,
      blockSyntaxes: [diagramTransformingFencedCodeBlock],
      extensionSet: markdown.ExtensionSet.gitHubWeb);
}   

final String markdownSource = r'''
# Example mermaid diagram

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```
''';

 

GitHub

https://github.com/timmaffett/kroki.dart
You might also like...

Coneectivity Service is for checking the internet connection using provider

Features Coneectivity Service is for checking the internet connection using provider. Installation Add the latest version of package to your pubspec.y

Nov 28, 2021

A Dart package to web scraping data from websites easily and faster using less code lines.

Chaleno A flutter package to webscraping data from websites This package contains a set of high-level functions that make it easy to webscrap websites

Jun 18, 2022

The package for building grpc channel depending on is it web or not

The package for building grpc channel depending on is it web or not Features The util builds gRPC channel for flutter web or other platforms condition

Nov 8, 2021

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

The Dart Time Machine is a date and time library for Flutter, Web, and Server with support for timezones, calendars, cultures, formatting and parsing.

Oct 8, 2021

Args simple - A simple argument parser and handler, integrated with JSON and dart

args_simple A simple argument parser and handler, integrated with JSON and dart:

Jan 22, 2022

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Log snapshot management solution (iOS/Android/Web/Server) built with Flutter/Dart using Bloc pattern and Firebase Firestore backend.

Dec 22, 2021

A to do list app for android, apple, and the web.

noted A new Flutter project. Getting Started FlutterFlow projects are built to run on the Flutter stable release. IMPORTANT: For projects with Firesto

Dec 31, 2021

Simple GEL converter to showcase Flutter basics. Fundamental widgets and simple methods.

gel_converter A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if

Oct 17, 2021

A simple command-line application to generate simple folder and file structure for Flutter Applications

A simple command-line application to generate simple folder and file structure for Flutter Applications

Kanza_cli is a simple command line tool to generate folder and file structure for your Flutter apps. To use it, you should do the followings: 1. First

Mar 10, 2022

Related

Dio Package in Flutter - HTTP Requests and Interceptors.
Dio Package in Flutter - HTTP Requests and Interceptors.

Dio Package in Flutter - HTTP Requests and Interceptors. Learn how to use Flutter Dio package to make http requests, deal with interceptors and take care of unexpected server responses and failures in Flutter apps.

Jun 12, 2022
WhatsApp API package for flutter, to send message and product information.
WhatsApp API package for flutter, to send message and product information.

WhatsApp API package for flutter, to send message and product information. Platform Support Android iOS MacOS Web Linux Windows ✔️ ✔️ ✔️ ✔️ ✔️ ✔️ What

Jun 17, 2022
A simple Flutter / Dart Utility class for converting complex objects to uri and query string

A simple Flutter / Dart Utility class for converting complex or nested objects to uri and query strings you can follow the the article on how this cla

Jan 6, 2022
Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Fontify The Fontify package provides an easy way to convert SVG icons to OpenType font and generate Flutter-compatible class that contains identifiers

May 1, 2022
Automatically generate usecase classes from your repository class definition in Dart and Flutter
Automatically generate usecase classes from your repository class definition in Dart and Flutter

Repo Case Automatically generate usecase classes from your repository class definition in Dart and Flutter. Check out the official guide on repo_case

May 23, 2022
AsyncCallQueue is a Dart class which provides a queuing mechanism to prevent concurrent access to asynchronous code.

async_call_queue AsyncCallQueue is a Dart class which provides a queuing mechanism to prevent concurrent access to asynchronous code. Getting Started

Jan 18, 2022
A generator to create config class from json files that support many environments

A generator to create config class from json files that support many environments. Motivation If you use a json file to config your applications, perp

Oct 9, 2021
A builder that generates an ArgsParser from a class

Parse command line arguments directly into an annotation class using the Dart Build System. Example Annotate a class with @CliOptions() from package:b

Jun 12, 2022
For test background service try to run ios

workmanager_example Demonstrates how to use the workmanager plugin. Getting Started This project is a starting point for a Flutter application. A few

Sep 20, 2021
FaaS (Function as a service) framework for writing portable Dart functions

Functions Framework for Dart This is a community-supported project, meaning there is no official level of support. The code is not covered by any SLA

Jun 27, 2022