Flutter Bangla Dictionary 📖 🇧🇩

A Flutter package that provides English-to-Bangla word translations using a preloaded JSON dictionary.

📌 Features

  • 🔍 Search for an English word and get its Bangla meaning.
  • 📂 Uses an offline JSON database (no internet required).
  • 🚀 Lightweight and easy to integrate.
  • 🎨 Simple API with fast lookup.

Here's a comprehensive documentation for your Flutter Bangla Dictionary package:

Flutter Bangla Dictionary

pub package license

A Flutter package that provides English to Bangla word translations and definitions. Easily integrate Bangla dictionary functionality into your Flutter applications.

Features

  • Search English words and get Bangla translations
  • Simple and intuitive API
  • Lightweight and fast
  • No internet connection required (offline database)
  • Supports Flutter Android, iOS, and web

Installation

Add this to your pubspec.yaml:

dependencies:
  flutter_bangla_dictionary: ^latest_version

Then run:

flutter pub get

Basic Usage

1. Import the package

import 'package:flutter_bangla_dictionary/flutter_bangla_dictionary.dart';

2. Search for word meanings

String? meaning = await FlutterBanglaDictionary.searchWord('hello');
print(meaning); // Prints Bangla translation

3. Full Example App

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

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Bangla Dictionary',
      theme: ThemeData(primarySwatch: Colors.deepPurple),
      home: const DictionaryScreen(),
    );
  }
}

class DictionaryScreen extends StatefulWidget {
  const DictionaryScreen({super.key});

  @override
  State<DictionaryScreen> createState() => _DictionaryScreenState();
}

class _DictionaryScreenState extends State<DictionaryScreen> {
  final _controller = TextEditingController();
  String _result = 'Search for a word';
  bool _loading = false;

  Future<void> _search() async {
    setState(() => _loading = true);
    final meaning = await FlutterBanglaDictionary.searchWord(_controller.text);
    setState(() {
      _result = meaning ?? 'Word not found';
      _loading = false;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Bangla Dictionary')),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            TextField(
              controller: _controller,
              decoration: const InputDecoration(
                labelText: 'Enter English word',
                border: OutlineInputBorder(),
              ),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: _loading ? null : _search,
              child: _loading 
                  ? const CircularProgressIndicator()
                  : const Text('Search'),
            ),
            const SizedBox(height: 20),
            Text(_result, style: const TextStyle(fontSize: 18)),
          ],
        ),
      ),
    );
  }
}

Advanced Usage

1. Error Handling

try {
  final meaning = await FlutterBanglaDictionary.searchWord('hello');
  if (meaning != null) {
    // Word found
  } else {
    // Word not found
  }
} catch (e) {
  // Handle any errors
}

2. Checking Word Existence

final exists = await FlutterBanglaDictionary.searchWord('word') != null;

FAQ

Q: How many words are included in the dictionary?

A: The package currently includes 103650 common English words with Bangla translations.

Q: Can I add custom words to the dictionary?

A: Currently the dictionary is read-only. For custom words, you'll need to maintain a separate database.

Q: Does this work offline?

A: Yes! All dictionary data is bundled with the package.

Screenshots

Include some screenshots of your dictionary in action here.

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

License

MIT License - see the LICENSE file for details.


This documentation follows best practices by:

  1. Providing clear installation instructions
  2. Showing basic and advanced usage examples
  3. Including API reference
  4. Adding FAQ section
  5. Following pub.dev formatting standards