hashgen_ai 1.0.3 copy "hashgen_ai: ^1.0.3" to clipboard
hashgen_ai: ^1.0.3 copied to clipboard

HashGen AI is a Flutter package that leverages OpenAI's API to generate relevant hashtags based on the provided content. This package simplifies the process of adding impactful hashtags to your conten [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:hashgen_ai/hashgen_ai.dart';

void main() {
  runApp(MyApp());
}

/// The main application widget.
class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HashGenAIExample(),
    );
  }
}

/// A stateful widget demonstrating the usage of HashGen AI.
class HashGenAIExample extends StatefulWidget {
  @override
  _HashGenAIExampleState createState() => _HashGenAIExampleState();
}

class _HashGenAIExampleState extends State<HashGenAIExample> {
  // Instance of HashGenAI initialized with the API key
  final HashGenAI hashGenAI = HashGenAI('YOUR_OPENAI_API_KEY');

  // List to store generated hashtags
  List<String> hashtags = [];

  /// Method to generate hashtags using HashGenAI
  void _generateHashtags() async {
    // Generate hashtags based on provided content
    final generatedHashtags = await hashGenAI.generateHashtags(
      'Flutter is an open-source UI software development toolkit created by Google.',
      5,
    );
    // Update the state with the generated hashtags
    setState(() {
      hashtags = generatedHashtags;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('HashGen AI Example'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            ElevatedButton(
              onPressed: _generateHashtags,
              child: Text('Generate Hashtags'),
            ),
            SizedBox(height: 16.0),
            // Display the generated hashtags
            ...hashtags.map((hashtag) => Text(hashtag)).toList(),
          ],
        ),
      ),
    );
  }
}
1
likes
130
pub points
12%
popularity

Publisher

unverified uploader

HashGen AI is a Flutter package that leverages OpenAI's API to generate relevant hashtags based on the provided content. This package simplifies the process of adding impactful hashtags to your content, enhancing its discoverability.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, http

More

Packages that depend on hashgen_ai