Installation
Adding GPT Markdown to your Flutter project is straightforward. Follow these steps to get started.
Requirements
Before installing GPT Markdown, ensure your Flutter project meets these requirements:
- Flutter SDK version 3.0.0 or higher
- Dart SDK version 2.17.0 or higher
Adding the Dependency
You can add GPT Markdown to your project using either Flutter's CLI tool or by manually editing your pubspec.yaml file:
flutter pub add gpt_markdownAfter adding the dependency, run flutter pub get to install the package.
Optional Dependencies
GPT Markdown has some optional features that require additional packages:
LaTeX Support
For LaTeX math rendering, ensure you have the following dependency:
dependencies:
flutter_math_fork: ^0.7.0Syntax Highlighting
For code syntax highlighting, ensure you have:
dependencies:
flutter_highlight: ^0.7.0Import the Package
After installing, you can import GPT Markdown in your Dart files:
import 'package:gpt_markdown/gpt_markdown.dart';Verify Installation
To verify that GPT Markdown is correctly installed, you can create a simple test widget:
import 'package:flutter/material.dart';
import 'package:gpt_markdown/gpt_markdown.dart';
class TestWidget extends StatelessWidget {
const TestWidget({super.key});
@override
Widget build(BuildContext context) {
return const GPTMarkdown(
markdownText: "# Hello from GPT Markdown!",
);
}
}Next Steps
Now that you have installed GPT Markdown, you can start using it in your Flutter app. Continue to the Basic Usage section to learn how to implement the package in your application.