AnkiMapping class

A user-generated mapping to allow customisation of the fields exported from the application. A mapping is bound to a model, which must have a length of fields equal or more than the length of getExportFields.

Annotations

Constructors

AnkiMapping({required String label, required String model, required List<String?> exportFieldKeys, required List<String> creatorFieldKeys, required List<String> creatorCollapsedFieldKeys, required int order, required List<String> tags, required bool? exportMediaTags, required bool? useBrTags, required bool? prependDictionaryNames, Map<String, Map<int, String>>? enhancements, Map<int, String>? actions, Id? id})
Initialise a model mapping with the given parameters.
AnkiMapping.defaultMapping({required Language language, required int order})
Get the default mapping that is included with the application at first startup. Requires a language so that the appropriate default enhancements are suggested.
factory

Properties

actions Map<int, String>?
Used to keep track of actions used in dictionary results.
read / write
actionsIsar String
Serializes actions.
read / write
creatorCollapsedFieldKeys List<String>
Returns the unique key equivalents of the field in getCreatorCollapsedFields that can be stored in a database.
read / write
creatorFieldKeys List<String>
Returns the unique key equivalents of the field in getCreatorFields that can be stored in a database.
read / write
enhancements Map<String, Map<int, String>>?
Used to keep track of enhancements used in the creator per field.
read / write
enhancementsIsar String
Serializes enhancements.
read / write
exportFieldKeys List<String?>
Returns the unique key equivalents of the field in getExportFields that can be stored in a database.
read / write
exportMediaTags bool?
Whether or not this mapping exports image and audio HTML/Anki syntax or only shows the filename. If null, will be considered false.
read / write
hashCode int
The hash code for this object.
read-onlyoverride
id Id?
A unique identifier for the purposes of database storage.
read / write
isExportFieldsEmpty bool
Whether or not this mapping has any non-empty fields set.
read-only
label String
The name of this mapping.
final
model String
The name of the model to use when exporting with this mapping.
final
order int
The order of this dictionary in terms of user sorting, relative to other dictionaries.
read / write
prependDictionaryNames bool?
Whether or not to add the dictionary name before the meaning.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
tags List<String>
A collection of tags to always include when exporting with this mapping.
final
useBrTags bool?
Whether or not this mapping exports
tags instead of \n.
read / write

Methods

copyWith({String? label, String? model, List<String?>? exportFieldKeys, List<String>? creatorFieldKeys, List<String>? creatorCollapsedFieldKeys, List<String>? tags, int? order, int? id, Map<String, Map<int, String>>? enhancements, Map<int, String>? actions, bool? exportMediaTags, bool? useBrTags, bool? prependDictionaryNames}) AnkiMapping
Creates a deep copy of this mapping but with the given variables replaced with the new values.
getActionNames() List<String>
Returns a list of action names active in the persisted actions map.
getActions({required AppModel appModel}) List<QuickAction>
Returns a list of actions active for the persisted actions map.
getAutoFieldEnhancement({required AppModel appModel, required Field field}) Enhancement?
Returns the enhancement active for a certain field in the persisted enhancements map.
getAutoFieldEnhancementName({required Field field}) String?
Returns the enhancement names active for a certain field in the persisted enhancements map.
getCreatorCollapsedFields() List<Field>
The ordering of the fields to hide in the Creator.
getCreatorFields() List<Field>
The ordering of the fields to show in the Creator.
getExportFields() List<Field?>
The ordering of the fields to use when exporting with this mapping. The length of this must be less or equal the length of the model being used for export to work correctly.
getManualFieldEnhancement({required AppModel appModel, required Field field}) List<Enhancement>
Returns a list of enhancements active for a certain field in the persisted enhancements map.
getManualFieldEnhancementNames({required Field field}) List<String>
Returns a list of enhancement names active for a certain field in the persisted enhancements map.
keysToFields(List<String> keys) List<Field>
Convert unique keys to fields.
keysToFieldsNullable(List<String?> keys) List<Field?>
Convert unique keys to fields.
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.
override

Static Properties

autoModeSlotNumber int
Reserved index for the auto mode field in the map of enhancement names for a field.
read / write
standardModelName String
The default mapping name which cannot be deleted or reused.
read / write
standardProfileName String
The default mapping name which cannot be deleted or reused.
read / write

Constants

defaultActionsByLanguage → const Map<String, Map<int, String>>
A default map of enhancements to use for new mappings.
{'ja-JP' : {0 : CardCreatorAction.key, 1 : InstantExportAction.key, 2 : AddToStashAction.key, 3 : CopyToClipboardAction.key, 4 : ShareAction.key, 5 : PlayAudioAction.key}, 'en-US' : {0…
defaultCreatorCollapsedFieldKeys → const List<String>
Default fields to show upon opening the Card Creator.
[TagsField.key, ContextField.key, ClozeBeforeField.key, ClozeInsideField.key, ClozeAfterField.key, FuriganaField.key, FrequencyField.key, PitchAccentField.key]
defaultCreatorFieldKeys → const List<String>
Default fields to show upon opening the Card Creator.
[SentenceField.key, TermField.key, ReadingField.key, MeaningField.key, NotesField.key, ImageField.key, AudioField.key, AudioSentenceField.key]
defaultEnhancementsByLanguage → const Map<String, Map<String, Map<int, String>>>
A default map of enhancements to use for new mappings.
{'ja-JP' : {SentenceField.key : {0 : ClearFieldEnhancement.key, 1 : TextSegmentationEnhancement.key, 2 : SentencePickerEnhancement.key}, TermField.key : {0 : ClearFieldEnhancement.key, 1 : Sea…