anki_connect_ios library
A simple and convenient Flutter package for connecting to AnkiMobile on iOS.
This package provides an easy-to-use API for adding cards to Anki decks using AnkiMobile's URL scheme on iOS devices.
Usage
import 'package:anki_connect_ios/anki_connect_ios.dart';
// Create the Anki client
final anki = AnkiConnectIOS();
// Check if AnkiMobile is available
bool isAvailable = await anki.isAnkiMobileAvailable();
// Add a simple card
final card = AnkiCard(
deckName: 'My Deck',
modelName: 'Basic',
front: 'Hello',
back: 'World',
);
await anki.addCard(card);
Setup
Make sure you have AnkiMobile installed on your iOS device.
Also add the following to your Info.plist:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>anki</string>
</array>
Classes
- AnkiCard
- Represents an Anki card to be added to a deck
- AnkiConnectIOS
- The main client for connecting to AnkiMobile on iOS
- AnkiDeck
- Represents an Anki deck
- AnkiModel
- Represents an Anki note type (model)
Exceptions / Errors
- AnkiAddCardException
- Exception thrown when adding a card fails
- AnkiDeckNotFoundException
- Exception thrown when the deck is not found
- AnkiException
- Base exception for all Anki-related errors
- AnkiMobileNotInstalledException
- Exception thrown when AnkiMobile is not installed
- AnkiModelNotFoundException
- Exception thrown when the note type (model) is not found
- AnkiOperationCancelledException
- Exception thrown when the app returns from AnkiMobile without completing