I have a problem with variable fonts: The function 'FontVariation' isn't defined

168 Views Asked by At

flutter code

errors

pubspec.yaml

font file

In flutter, I have a problem when using variable fonts: The function 'FontVariation' isn't defined. Try importing the library that defines 'FontVariation', correcting the name to the name of an existing function, or defining a function named 'FontVariation'. Could it be that I didn't import something?

style: TextStyle(
    fontVariations: const <FontVariation>[
        FontVariation("wght", 500),
    ],
),
1

There are 1 best solutions below

0
Ashikul Islam Sawan On BEST ANSWER

Make sure that you've imported the dart ui package.

import 'dart:ui';