HTML to Text API - Dart/Flutter Client

HTML to Text extracts clean plain text from raw HTML markup, reporting word counts and character counts. It identifies main article bodies automatically, records the extraction method used, and notes whether parsing succeeded.

pub package License: MIT

This is the Dart/Flutter client for the HTML to Text API.

Installation

Add this to your pubspec.yaml:

dependencies:
  apiverve_htmltotext: ^1.2.6

Then run:

dart pub get
# or for Flutter
flutter pub get

Usage

import 'package:apiverve_htmltotext/apiverve_htmltotext.dart';

void main() async {
  final client = HtmltotextClient('YOUR_API_KEY');

  try {
    final response = await client.execute({
      'html': '<!doctype html> <html>  <head> <title>This is the title of the webpage!</title> </head> <body> <p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p> </body> </html>'
    });

    print('Status: ${response.status}');
    print('Data: ${response.data}');
  } catch (e) {
    print('Error: $e');
  }
}

Response

{
  "status": "ok",
  "error": null,
  "data": {
    "text": "This is an example paragraph. Anything in the body tag will appear on the page, just like this p tag and its contents.",
    "parsed": true,
    "extractionMethod": "article",
    "detectedLanguage": {
      "language": "english",
      "confidence": 0.3507446808510638
    },
    "characterCount": 118,
    "wordCount": 23
  }
}

API Reference

Authentication

All requests require an API key. Get yours at apiverve.com.

License

MIT License - see LICENSE for details.


Built with Dart for APIVerve

Libraries

apiverve_htmltotext
HTML to Text API client for Dart/Flutter