lookup library

Runtime lookup of flags by UF code, for dropdowns and address forms.

This is a separate import on purpose. The tables here name every flag in a style, so importing this library means your app carries all 28 of them rather than only the ones you wrote out by hand. That is the right trade when you genuinely need to pick a flag from a string at runtime, and the wrong one when you just want two or three fixed flags.

import 'package:brazil_state_flags/lookup.dart';

final flag = flagForUf('sp', style: FlagStyle.circle);
if (flag != null) BrazilStateFlag(flag, size: 32);

// Building a picker:
for (final state in brazilStates) {
  print('${state.uf} ${state.name}');
}

Classes

BrazilState
One state, paired with the artwork for it.

Enums

FlagStyle
The four artwork styles.

Constants

brazilStateNames → const Map<String, String>
UF code to the state name, in Portuguese.

Properties

brazilStates List<BrazilState>
Every state and the Federal District, ordered by UF code.
final

Functions

flagForUf(String uf, {FlagStyle style = FlagStyle.circle}) FlagArtwork?
Returns the flag for uf, or null when the code is not recognised.
stateNameForUf(String uf) String?
The state name in Portuguese for uf, or null when unrecognised.