I am creating a package. I've added two directories, fonts and images, consecutive to the lib directory. I've also added the required code in pubspec.yaml file to use those fonts and images in the package. I created an example directory in the package directory in order to test the package I'm creating, but the test app won't pick the fonts and images from the package and gives the exception:
FlutterError (Unable to load asset: images/abc.png)
Screenshot of directories [1]: https://i.stack.imgur.com/po8oT.png
pubspec.yaml:
name: customtestingpackage
description: A new Flutter package project.
version: 0.0.1
author:
homepage:
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons:
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
fonts:
- family: Comfortaa
fonts:
- asset: fonts/comfortaa/Comfortaa-Regular.ttf
weight: 400
- asset: fonts/comfortaa/Comfortaa-Medium.ttf
weight: 500
- family: Poppins
fonts:
- asset: fonts/poppins/Poppins-Regular.ttf
weight: 400
- asset: fonts/poppins/Poppins-Medium.ttf
weight: 500
main.dart: implementation of fonts
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w500,
color: Colors.white,
fontFamily: 'Poppins',
letterSpacing: 1.25,
),