Implementations

Flutter

Cryptofonts is available as a Flutter package.

SDK | Flutter PLATFORMS | Android, OSX, Linux, MacOS, Web, Windows

Installing

flutter pub add cryptofont

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get)

dependencies:
  cryptofont: ^1.0.2+1

Alternatively, your editor might support flutter pub get

Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:cryptofont/cryptofont.dart';

Usage

import 'package:cryptofont/cryptofont.dart';

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

  @override
  Widget build(BuildContext context) {
    // Get the icon code if you need it
    final code = cryptoFontIconMapping[symbol.toLowerCase()];

    return Row(
      children: [
        // Use directly
        const Icon(CryptoFontIcons.btc),
        // Or by using the symbol
        Icon(CryptoFontIcons.fromSymbol("BTC")),
        // Case insensitive, this works too
        Icon(CryptoFontIcons.fromSymbol("btc")),
      ],
    );
  }
} 

Example

example/lib/main.dart

Last updated