flutter_highlighting 0.9.0+11.8.0 copy "flutter_highlighting: ^0.9.0+11.8.0" to clipboard
flutter_highlighting: ^0.9.0+11.8.0 copied to clipboard

Syntax highlighting widget for Flutter with lots of languages and themes support.

flutter_highlighting #

Code syntax highlighting library for over 190 languages.

If you are looking for the pure Dart package, see highlighting.

This package is a port of HighlightJS project into Dart. It is periodically updated from the original JavaScript version with an automated script.

Usage #

import 'package:flutter/material.dart';
import 'package:flutter_highlighting/flutter_highlighting.dart';
import 'package:flutter_highlighting/themes/github.dart';
import 'package:highlighting/languages/dart.dart';

class MyWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final code = '''main() {
  print("Hello, World!");
}
''';

    return HighlightView(
      // The original code to be highlighted
      code,

      // Specify language
      // It is recommended to give it a value for performance
      languageId: dart.id,

      // Specify highlight theme
      // All available themes are listed in `themes` folder
      theme: githubTheme,

      // Specify padding
      padding: EdgeInsets.all(12),

      // Specify text style
      textStyle: TextStyle(
        fontFamily: 'My awesome monospace font',
        fontSize: 16,
      ),
    );
  }
}

Versions and Migration #

The package uses its own version numbering in addition to that of HighlightJS. For example, the version 0.9.0+11.8.0 means that it is:

  • Version 0.9.0 of the Dart package itself, and it contains breaking changes over the version 0.8.x.
  • Ported from HighlightJS version 11.8.0.

This allows the pub tool to automatically guard you against breaking changes.

Migration guides:

Maintainer's Guide #

References #

14
likes
130
pub points
89%
popularity

Publisher

verified publisherakvelon.com

Syntax highlighting widget for Flutter with lots of languages and themes support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, highlighting

More

Packages that depend on flutter_highlighting