Skip to content

FileData

A Data object holding a link to a file, e.g. an audio recording or image.

The file itself is stored on the phone at path. A data manager can upload the file in addition to this metadata, if upload is true.

Inheritance
Annotations

Constructors

FileData.fromJson

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

FileData

FileData({
  1. required String filename,
  2. bool upload = true,
})

Creates a new FileData for filename and whether it is to be uploaded.

Properties

filename

String filename
getter/setter pair

The name of the attached file.

fromJsonFunction

Function get fromJsonFunction
override

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

metadata

Map<String, String>? metadata
getter/setter pair

Metadata for this file as a map of string key-value pairs.

path

String? path
getter/setter pair

The local path to the attached file on the phone where it is sampled. This is used by e.g. a data manager to get and manage the file on the phone.

upload

bool upload
getter/setter pair

Whether to upload the file too, or only this metadata. Default is true.

Methods

equivalentTo

bool equivalentTo(
  1. Data other
)
override

Is this data equivalent to other?

This is a custom 'soft' equal (==) operator used to compare two data objects. Used in triggering when some data is collected. Override in subclasses to provide custom equivalence checking.

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.