DictionaryFormat class
Information making up a supported dictionary format, as well as the methods that the format will use in a separate isolate for importing or enabling a dictionary of the matching format. Methods are top-level and should be defined in the global scope below the class declaration of a dictionary format.
- Implementers
Constructors
-
DictionaryFormat({required String uniqueKey, required String name, required IconData icon, required List<
String> allowedExtensions, required bool isTextFormat, required FileType fileType, required Future<void> prepareDirectory(PrepareDirectoryParams params), required Future<String> prepareName(PrepareDirectoryParams params), required Future<Map< prepareEntries(PrepareDictionaryParams params), required Future<DictionaryHeading, List< >DictionaryEntry> >List< prepareTags(PrepareDictionaryParams params), required Future<DictionaryTag> >Map< preparePitches(PrepareDictionaryParams params), required Future<DictionaryHeading, List< >DictionaryPitch> >Map< prepareFrequencies(PrepareDictionaryParams params)})DictionaryHeading, List< >DictionaryFrequency> > - Define a format with the given metadata that has its behaviour for import, search and display defined with a set of top-level helper methods.
Properties
-
allowedExtensions
↔ List<
String> -
This will be used to notify the user about the required extension if they
select a file with the wrong extension. Elements should not include
leading dots.
read / write
- fileType → FileType
-
Whether or not the file picker supports the file extensions of this
format.
final
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- icon ↔ IconData
-
An appropriate icon for this dictionary format.
read / write
- isTextFormat ↔ bool
-
If this is true, the charset of this format will be taken.
read / write
- name ↔ String
-
The display name of this dictionary format. For example, this could be a
'Yomichan Dictionary' or 'ABBYY Lingvo'.
read / write
-
prepareDirectory
↔ Future<
void> Function(PrepareDirectoryParams params) -
IMPORTANT
: The following parameters below point to functions defined in the top-level, not within the inheriting class. They are meant to be defined in the constructor -- the actual functions to be executed are outside of the class, placed preferably at the bottom of the inheriting format class. This is because these functions should not block the UI isolate and must be top-level in order to do so. Given a File, prepare files to be accessible in a working Directory such that it will be possible to make relative commands (in the directory) to be able to get a dictionary's name, its entries and other related metadata that will be useful for preservation.read / write -
prepareEntries
↔ Future<
Map< Function(PrepareDictionaryParams params)DictionaryHeading, List< >DictionaryEntry> > -
Prepares a map with entries that will be added to the database.
See PrepareDictionaryParams for how to work with the individual input
parameters.
read / write
-
prepareFrequencies
↔ Future<
Map< Function(PrepareDictionaryParams params)DictionaryHeading, List< >DictionaryFrequency> > -
Prepares a map with frequency entries that will be added to the database.
See PrepareDictionaryParams for how to work with the individual input
parameters.
read / write
-
prepareName
↔ Future<
String> Function(PrepareDirectoryParams params) -
Given a Directory of files pertaining to this dictionary format,
return a String that will refer to a dictionary's name in this format.
read / write
-
preparePitches
↔ Future<
Map< Function(PrepareDictionaryParams params)DictionaryHeading, List< >DictionaryPitch> > -
Prepares a map with pitch entries that will be added to the database.
See PrepareDictionaryParams for how to work with the individual input
parameters.
read / write
-
prepareTags
↔ Future<
List< Function(PrepareDictionaryParams params)DictionaryTag> > -
Prepares a list of tags that will be added to the database.
See PrepareDictionaryParams for how to work with the individual input
parameters.
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
- uniqueKey ↔ String
-
This is used to distinguish dictionary formats from one another, and to
allow editing of the display name easily without having to worry about
backwards compatibility.
read / write
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited