Skip to content

FileDataEndPoint

A DataEndPoint that stores measurements as JSON files on the phone.

Used by the FileDataManager. Files can be zipped and encrypted.

Inheritance
Annotations

Constructors

FileDataEndPoint.fromJson

FileDataEndPoint.fromJson(
  1. Map<String, dynamic> json
)

FileDataEndPoint

FileDataEndPoint({
  1. String dataFormat = NameSpace.CARP,
  2. int bufferSize = 500 * 1000,
  3. bool zip = true,
  4. bool encrypt = false,
  5. String? publicKey,
})

Creates a FileDataEndPoint of type DataEndPointTypes.FILE.

Properties

bufferSize

int bufferSize
getter/setter pair

The buffer size of the raw JSON file in bytes.

All collected data is written to a JSON file until the buffer is filled, at which time the file will be zipped. There is not a single-best bufferSize value. If data are collected at high rates, a higher value will be best to minimize zip operations. If data are collected at low rates, a lower value will be best to minimize the likelihood of data loss when the app is killed or crashes. Default size is 500 KB (500 * 1000 bytes).

encrypt

bool encrypt
getter/setter pair

Whether to encrypt the data before storing it. Default is false.

Support only one-way encryption using a public key.

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

publicKey

String? publicKey
getter/setter pair

The public key for RSA encryption of the data, used if encrypt is true.

zip

bool zip
getter/setter pair

Whether to compress (zip) the data before storing it in a file. Default is true.

If zipped, the JSON file will be reduced to 1/5 of its size. For example, the 500 KB buffer typically is reduced to ~100 KB.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.

toString

String toString()
override

A string representation of this object.

Some classes have a default textual representation, often paired with a static parse function (like int.parse). These classes will provide the textual representation as their string representation.

Other classes have no meaningful textual representation that a program will care about. Such classes will typically override toString to provide useful information when inspecting the object, mainly for debugging or logging.