iconify_design_flutter 1.0.3
iconify_design_flutter: ^1.0.3 copied to clipboard
A Flutter package that allows you to use icons from the Iconify.design API with ease.
Iconify Design Flutter #
iconify_design_flutter lets you use icons from Iconify in Flutter. Icons are fetched once, cached in memory and on disk, then reused.
Features #
- Fetch SVG icons from Iconify by id (
prefix:name) - Memory + disk cache, with in-flight request dedupe
- Updates when
iconchanges at runtime - Respects
IconThemefor default color/size - Optional accessibility label and loading placeholder
Installation #
Add the package to your pubspec.yaml:
dependencies:
iconify_design_flutter: ^1.0.3
Run:
flutter pub get
Usage #
import 'package:iconify_design_flutter/iconify_design_flutter.dart';
IconifyIcon(
icon: "mdi:home",
color: Colors.black,
size: 32,
semanticsLabel: 'Home',
)
Runtime icon changes work without restarting the app:
IconifyIcon(
icon: isFavorite ? "mdi:heart" : "mdi:heart-outline",
)
Optional loading placeholder:
IconifyIcon(
icon: "mdi:home",
placeholder: SizedBox(
width: 24,
height: 24,
child: CircularProgressIndicator(strokeWidth: 1),
),
)
Clear caches if needed:
IconService.clearMemoryCache();
await IconService.clearAllCaches();
How it works #
- Validates
prefix:name - Returns from memory cache when available
- Otherwise checks SharedPreferences
- Otherwise fetches from Iconify and stores in memory + disk
- Concurrent requests for the same icon share one network call
Dependencies #
dio– HTTPflutter_svg– SVG renderingshared_preferences– disk cache
Links #
Contribution #
- Report issues via GitHub Issues
- Pull requests welcome
License #
MIT – see LICENSE