You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a few Dart (but not Flutter) applications which use the same non-code asset - in this case a font. This font, while not code itself, nonetheless runs through much of the some lifecycle as code would; it can be committed to a git repository and has semantic version numbers which are incremented as the font is developed.
I'd like to be able to create a package for this font, and then depend upon that package in other packages. For example:
name: myfontversion: 1.1.5description: A really awesome font.
EpubBuilder package
pubspec.yaml
name: epubbuilderversion: 1.0.0description: A application that creates epubs with an awesome font!dependencies:
myfont: ^1.1.0epubx: ^4.0.0
main.dart
import'package:epubx/epubx.dart';
import'package:myfont/fonts/myfont.otf'as myfontotf;
voidmain() {
finalEpubBook book =EpubBook();
// do some stuff to build a great ebookembedFont(book, myfontotf);
EpubWriter.writeBook(book);
}
voidembedFont(EpubBook book, File fontFile) {
finalUint8List fontData = fontFile.readAsBytesSync();
finalEpubByteContentFile myfontContentFile =EpubByteContentFile()
..Content= fontData
..ContentMimeType='application/vnd.ms-opentype'
..ContentType=EpubContentType.FONT_OPENTYPE
..FileName= myfont.otf;
book.Content!.AllFiles![myfontContentFile.FileName!] = myfontContentFile;
}
That's just a guess at what the syntax might look like, but hopefully it gets the idea across well enough.
Note: I wouldn't expect non-code packages like this to be publishable to pub.dev, but rather just to be something which could be depended upon via path or hosted.
The text was updated successfully, but these errors were encountered:
I have a few Dart (but not Flutter) applications which use the same non-code asset - in this case a font. This font, while not code itself, nonetheless runs through much of the some lifecycle as code would; it can be committed to a git repository and has semantic version numbers which are incremented as the font is developed.
I'd like to be able to create a package for this font, and then depend upon that package in other packages. For example:
MyFont package
Package Structure
pubspec.yaml
EpubBuilder package
pubspec.yaml
main.dart
That's just a guess at what the syntax might look like, but hopefully it gets the idea across well enough.
Note: I wouldn't expect non-code packages like this to be publishable to pub.dev, but rather just to be something which could be depended upon via
path
orhosted
.The text was updated successfully, but these errors were encountered: