To understand my question, we need to follow the example below which from the official flutter documentation:
flutter:
fonts:
- family: Raleway
fonts:
- asset: fonts/Raleway-Regular.ttf
- asset: fonts/Raleway-Italic.ttf
style: italic
- family: RobotoMono
fonts:
- asset: fonts/RobotoMono-Regular.ttf
- asset: fonts/RobotoMono-Bold.ttf
weight: 700
As you know this is how we declare font in Flutter and we know that we have Raleway-Regular.ttf
, Raleway-Italic.ttf
, RobotoMono-Regular.ttf
and RobotoMono-Bold.ttf
inside the fonts
directory at the root of our project.
So my question is why do we need to set the weight
property of the RobotoMono-Bold.ttf
to 700
, when by default RobotoMono-Bold.ttf
has FontWeight.w700
The documentation quotes
Note that defining the weight property does not override the actual weight of the font. You would not be able to access RobotoMono-Bold with FontWeight.w100, even if its weight was set to 100.
As per the documentation if defining the weight property does not override the actual weight of the font, then why the weight
property exist? Same goes for the style
property as well.