flutter_initials 1.0.3

SDKflutter
Platformandroidioswindowslinuxmacosweb

A lightweight Dart utility for extracting initials from a full name, designed for use in Flutter apps. Perfect for generating avatars, short representations of names, or tags.

Here's a clean and professional README.md file for your flutter_initials package:


# flutter_initials

A lightweight Dart utility for extracting initials from a full name, designed for use in Flutter apps. Perfect for generating avatars, short representations of names, or tags.

## Features

- Extracts the first letter of each word in a name
- Converts to uppercase
- Preserves numbers if found in words
- Trims special characters
- Limits output to 4 characters max

## Installation

Add the following to your `pubspec.yaml`:

```yaml
dependencies:
  flutter_initials: ^1.0.3
```

Then run:

flutter pub get

Usage

Import the package:

import 'package:flutter_initials/flutter_initials.dart';

Use the utility:

String initials = FlutterInitials.getInitials("John Doe" , 4);
print(initials); // Output: JD

Examples

InputOutputExplanation
"John Doe"JDFirst letters of first and last name
"Mary-Kate Olsen"MKHyphen removed, initials from both words
"Élodie Yung"EYSpecial characters removed
"Agent 47"A47Numbers preserved
"Albus Percival Wulfric Brian Dumbledore"APWBMax 4 initials
" jack o'neill "JOExtra spaces and special characters cleaned

Use Cases

Use the utility:

String initials = FlutterInitials.toCamelCase("John Doe");
print(initials); // Output: johnDoe
InputOutputExplanation
"John Doe"johnDoeCamel case
"Mary-Kate Olsen"maryKateOlsenCamel case, hyphen removed
"Mary-Kate Olsen"MaryKateOlsenPascal case, hyphen removed
"Mary-Kate Olsen"mary_kate_olsenSnake case, hyphen removed

Contributing

Feel free to open issues or submit pull requests for improvements or new features.

License

MIT License


---

Let me know if you'd like help publishing to pub.dev or adding additional badges (e.g. build status, version, likes).