JsonDocumentSourceModelAdapter constructor

const JsonDocumentSourceModelAdapter({
  1. List<ModelInitialValue>? initialValue,
  2. NoSqlDatabase? database,
  3. String? collectionPath,
  4. String? documentId,
  5. required String source,
  6. Map<String, String>? requestHeaders,
  7. String? requestMethod,
})

A database adapter that uses Json files as a data source.

Json files can be used as configuration files for settings and other purposes.

URL, asset path, or Json data can be directly specified in source.

requestHeaders specifies request headers to be sent when requesting as HTTP.

requestMethod specifies the request method to be sent when requesting as HTTP.

By passing data to initialValue, the database can be used as a data mockup because it contains data in advance.

If validator is specified, validation is performed in the database.

Jsonファイルをデータソースとして利用するデータベースアダプター。

Jsonファイルで設定などを行う場合、設定ファイルとして利用することができます。

sourceにはURLやアセットパス、Jsonデータを直接指定することができます。

requestHeadersにはHTTPとしてリクエストする際に送るリクエストヘッダーを指定します。

requestMethodにはHTTPとしてリクエストする際に送るリクエストメソッドを指定します。

initialValueにデータを渡すことで予めデータが入った状態でデータベースを利用することができるためデータモックとして利用することができます。

validatorを指定するとデータベース内でのバリデーションが行われます。

Use the Json containing the map as documentation.

マップを含むJsonをドキュメントとして利用します。

{
  "id": 1,
  "name": "John",
  "age": 20
}

->

{
  "id": 1,
  "name": "John",
  "age": 20
}

Implementation

const JsonDocumentSourceModelAdapter({
  super.initialValue,
  super.database,
  super.collectionPath,
  this.documentId,
  required super.source,
  super.requestHeaders,
  super.requestMethod,
});