CarpService class

Provide access to a CARP web service endpoint.

The (current) assumption is that each Flutter app (using this library) will only connect to one CARP web service backend. Therefore a CarpService is a singleton and can be used like:

  CarpService().configure(myApp);
  CarpUser user = await CarpService()
    .authenticate(username: "user@dtu.dk", password: "password");
Inheritance

Constructors

CarpService()
Returns the singleton default instance of the CarpService. Before this instance can be used, it must be configured using the configure method.
factory
CarpService.instance()

Properties

app CarpApp
The CARP app associated with the CARP Web Service. Returns null if this service has not yet been configured via the configure method.
no setteroverride
consentDocumentEndpointUri String
The URL for the consent document end point for this CarpService.
no setter
documentEndpointUri String
The URL for the document end point for this CarpService.
no setter
fileEndpointUri String
The URL for the file end point for this CarpService.
no setter
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
The headers for any authenticated HTTP REST call to this CarpService.
no setteroverride
isConfigured bool
Has this service been configured?
no setterinherited
rpcEndpointName String
The endpoint name for this service at CARP.
no setteroverride
rpcEndpointUri String
The URL for this service's endpoint at CARP.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

collection(String path) CollectionReference
Gets a CollectionReference for the specified path.
configure(CarpApp app) → void
Configure the this instance of a Carp Service.
inherited
configureFrom(CarpBaseService service) → void
Configure from another service which has already been configured and potentially authenticated.
inherited
createConsentDocument(Map<String, dynamic> document) Future<ConsentDocument>
Create a new (signed) consent document for this user. Returns the created ConsentDocument if the document is uploaded correctly.
document(String path) DocumentReference
Gets a DocumentReference for the specified path.
documentById(int id) DocumentReference
Gets a DocumentReference for the specified unique id.
documents() Future<List<DocumentSnapshot>>
Get all documents for this study.
documentsByQuery(String query) Future<List<DocumentSnapshot>>
Get a list documents based on a query.
getAllFiles() Future<List<CarpFileResponse>>
Get all file objects in the study.
getConsentDocument(int id) Future<ConsentDocument>
Get a previously uploaded (signed) ConsentDocument based on its id.
getDataPointReference() DataPointReference
Creates a new DataPointReference initialized at the current CarpService storage location.
getFileStorageReference([int id = -1]) FileStorageReference
Get a FileStorageReference that reference a file at the current CarpService storage location. id can be omitted if a local file is not uploaded yet.
getFileStorageReferenceByName(String name) Future<FileStorageReference?>
Get a FileStorageReference that reference a file with the original name name at the current CarpService storage location.
nonNullAble<T>(T? argument) → T
Makes sure that the CarpApp or CarpUser is configured, by throwing a CarpServiceException if they are null. Otherwise, returns the non-null value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
queryFiles([String? query]) Future<List<CarpFileResponse>>
Returns file objects in the study based on a query.
toString() String
A string representation of this object.
inherited

Operators

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