Wilt class Null safety

The Wilt client.

  • The Wilt class provides core functionality for interacting with CouchDB databases from both the browser and the server.

Constructors

Wilt(dynamic host, {int port = 5984, bool useSSL = false})
Please use the wilt_browser_client or wilt_server_client import files to instantiate a Wilt object for use in either the browser or server environment. You can do this here but you must supply either a browser or server HTTP adapter to use.

Properties

authenticationType String
Authentication, type
read / write
changeNotification Stream<WiltChangeNotificationEvent>
Change notification event stream This is a broadcast stream so can support more than one listener.
read-only
changeNotificationDbName String?
Change notification database name
read / write
changeNotificationsPaused bool
Change notification paused state
read-only
completionResponse JsonObjectLite?
read-only
db String?
Database name
read / write
hashCode int
The hash code for this object. [...]
read-only, inherited
host → dynamic
Domain name or IP address of couchdb server
final
port int
Port number, defaults to 5984 (the couchdb default)
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
useSSL bool
Use SSL when connecting to couchdb, defaults to false
final

Methods

bulk(List<JsonObjectLite> docs, [bool allOrNothing = false]) Future
Bulk insert Bulk inserts a list of documents
bulkString(String docs, [bool allOrNothing = false]) Future
Bulk insert json string version. Must be used if '_id' and or '_rev' are needed in ANY of the documents
copyDocument(String? sourceId, String? destinationId, [String? rev]) Future
Copies the source document to the destination document with an optional revision. NOTE this method uses the CouchDB COPY method which is not standard HTTP.
createAttachment(String? docId, String? attachmentName, String? rev, String? contentType, String? payload) Future
Create an attachment on an existing document. contentType is in the form of a mime type e.g. 'image/png' If the document needs to be created as well as the attachment set the rev to ''.
createDatabase(String? name) Future
Creates a database with the specified name.
delete(String? url) Future
Performs a HTTP DELETE operation,, the URL is conditioned and the current database added.
deleteAttachment(String? docId, String? attachmentName, String? rev) Future
Delete an attachment
deleteDatabase(String? name) Future
Deletes the specified database
deleteDocument(String? id, String? rev, [bool preserve = false]) Future
DELETE's the specified document. Must have a revision. If preserve is set to true the whole document is preserved and marked as deleted otherwise only a stub document is kept. Default is to not preserve.
doHttpRequest(String method, String url, [String? data, Map<String, String> headers = const {}]) Future
Processes the HTTP request, returning the server's response as a future
generateIds([int amount = 10]) Future
Ask CouchDB to generate document Id's.
get(String? url) Future
Performs an HTTP GET operation, the URL is conditioned and the current database added.
getAllDbs() Future
Get all the databases from CouchDB
getAllDocs({bool includeDocs = false, int? limit, String? startKey, String? endKey, List<String>? keys, bool descending = false}) Future
Get all documents. The parameters should be self explanatory and are addative. Refer to the CouchDb documentation for further explanation.
getAttachment(String? docId, String? attachmentName) Future
Get an attachment
getDatabaseInfo([String? dbName]) Future
Get information about a database
getDocument(String? id, [String? rev, bool withAttachments = false]) Future
Performs an HTTP GET operation for the supplied document id and optional revision. If withAttachments is set the the body of any attachments are also supplied, note this could make this a large transfer.
getDocumentRevision(String? id) Future
Gets a documents current revision, returns null if the document does not exist.
getSession() Future
Get current session information from CouchDB
getStats() Future
Get current stats from CouchDB, 1.xx versions only
getString(String url) Future<String>
Specialised 'get' for change notifications
Performs a HTTP HEAD operation, the URL is conditioned and the current database added.
httpRequest(String url, {String method = 'GET'}) Future
Basic method where only a URL and a method is passed. Wilt applies no checks to this URL nor does it add the database, the format of this is entirely up to the user. [...]
login(String? user, String? password) → void
Authentication. Updates the login credentials in Wilt that will be used for all further requests to CouchDB. Both user name and password must be set, even if one or the other is '' i.e empty. After logging in all communication with CouchDB is made using the selected authentication method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notificationAuthParams(String? user, String? password, String authType) → void
Authentication parameters for change notification
pauseChangeNotifications() → void
Pause change notifications
post(String? url, String data, [Map<String, String>? headers]) Future
Performs a HTTP POST operation,, the URL is conditioned and the current database added.
postDocument(JsonObjectLite? document, {String? path}) Future
POST's the specified document. An optional path to the document can be specified.
postDocumentString(String? document, {String? path}) Future
POST's to the specified document where the document is supplied as a json string. Must be used if '_id' and or '_rev' are needed.
put(String? url, String data, [Map<String, String>? headers]) Future
Performs a HTTP PUT operation,, the URL is conditioned and the current database added.
putDocument(String? id, JsonObjectLite? document, [String? rev]) Future
PUT's to the specified document. [...]
putDocumentString(String id, String document, [String? rev]) Future
PUT's to the specified document where the document is supplied as a json string. Must be used if '_id' and or '_rev' are needed.
restartChangeNotifications() → void
Restart change notifications after a pause
startChangeNotification([WiltChangeNotificationParameters? parameters, String? databaseName]) → void
Change notification start, see the WiltChangeNotification class for more details. [...]
stopChangeNotification() → void
Change notification stop, see the WiltChangeNotification class for more details [...]
toString() String
A string representation of this object. [...]
inherited
updateAttachment(String? docId, String? attachmentName, String? rev, String? contentType, String? payload) Future
Update an attachment on an existing document. contentType is in the form of a mime type e.g. 'image/png'
updateChangeNotificationParameters(WiltChangeNotificationParameters parameters) → void
Change the parameter set for change notifications. [...]

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Constants

alldbs → const String
URL constant for CouchDB ALLDBS function
'/_all_dbs'
alldocs → const String
URL constant for CouchDB ALLDOCS function
'/_all_docs'
authBasic → const String
AUTH_BASIC denotes Basic HTTP authentication. If login is called AUTH_BASIC is set, otherwise it defaults to AUTH_NONE
'basic'
authNone → const String
No authentication
'none'
bulkdocs → const String
URL constant for CouchDB BULKDOCS function
'/_bulk_docs'
bulkk → const String
'POST_BULK'
bulkStringg → const String
'POST_BULKSTRING'
copy → const String
'COPY_COPY'
copyDocumentt → const String
'COPY_DOCUMENT'
createAttachmentt → const String
'PUT_CREATEATTACH'
createDatabasee → const String
'PUT_DATABASE'
databaseInfo → const String
'GET_DATABASEINFO'
deleteAttachmentt → const String
'DELETE_ATTACH'
deleteDatabasee → const String
'DELETE_DATABASE'
deleteDocumentt → const String
'DELETE_DOCUMENT'
deletee → const String
'DELETE_DELETE'
etag → const String
Etag header
'etag'
generateIdss → const String
'GET_IDS'
getAllDbss → const String
'GET_ALLDBS'
getAllDocss → const String
'GET_ALLDOCS'
getAttachmentt → const String
'GET_ATTACH'
getDocumentt → const String
'GET_DOCUMENT'
getSessionn → const String
'GET_SESSION'
getStatss → const String
'GET_STATS'
gett → const String
Operation types and method definitions
'GET_GET'
headd → const String
'HEAD_HEAD'
postDocumentStringg → const String
'POST_DOCUMENTSTRING'
postDocumentt → const String
'POST_DOCUMENT'
postt → const String
'POST_POST'
putDocumentt → const String
'PUT_DOCUMENT'
putt → const String
'PUT_PUT'
session → const String
URL constant for CouchDB SESSION function
'/_session'
stats → const String
URL constant for CouchDB STATS function
'/_stats'
updateAttachmentt → const String
'PUT_UPDATEATTACH'
uuids → const String
URL constant for CouchDB UUID function
'/_uuids'