You can use custom fonts in your Flutter application by including them in your
pubspec.yaml file under the
fonts heading in your
flutter: fonts: - family: Raleway fonts: - asset: assets/fonts/Raleway-Regular.ttf - asset: assets/fonts/Raleway-Medium.ttf weight: 500 - asset: assets/fonts/Raleway-SemiBold.ttf weight: 600 - family: AbrilFatface fonts: - asset: assets/fonts/abrilfatface/AbrilFatface-Regular.ttf
asset is a path to the font file, relative to the
These files contain the outlines for the glyphs in the font. When building your
app, these files are included in your app’s asset bundle.
A single font can reference many different files with different outline weights and styles:
weightproperty specifies the weight of the outlines in the file as an integer multiple of 100 between 100 and 900. These values correspond to the
FontWeightand can be used in the
fontWeightproperty of a
object specifies a weight or style for which is there is no exact font file, the
engine uses one of the more generic files for the font and attempts to
extrapolate outlines for the requested weight and style.