DataSet class Null safety

DataSet is a dynamic generic DTO.

DataSet can represent a data structure that summarizes multiple forms. A report usually has a header part, which is a one-dimensional data structure, and a table part, which is a two-dimensional data structure.

The header part is represented by Record and the table part is represented by RecordList. DataSet can have multiple names for each of Record, which is a header, and RecordList, which is a table.

For example

import 'package:nimbus4flutter/nimbus4flutter.dart';

DataSet dataSet = DataSet("CurriculumVitae");
dataSet.setHeaderSchema(
  RecordSchema(
    [
      FieldSchema<String>("name"),
      FieldSchema<int>("age")
    ]
  ),
  "User"
);
dataSet.setRecordListSchema(
  RecordSchema(
    [
      FieldSchema<String>("title"),
      FieldSchema<String>("description"),
      FieldSchema<DateTime>("from"),
      FieldSchema<DateTime>("to")
    ]
  ),
  "Career"
);

Record userHeader = dataSet.getHeader("User");
userHeader["name"] = "hoge";
userHeader["age"] = 20;

RecordList careerList = dataSet.getRecordList("Career");
careerList.add(
  careerList.createRecord(
    {
      "title":"career1",
      "description":"description1",
      "from":DateFormat('yyyy/MM/dd').parse("2020/01/01"),
      "to":DateFormat('yyyy/MM/dd').parse("2020/01/30")
    }
  )
);
careerList.add(
  careerList.createRecord(
    {
      "title":"career2",
      "description":"description2",
      "from":DateFormat('yyyy/MM/dd').parse("2020/02/01"),
      "to":DateFormat('yyyy/MM/dd').parse("2020/02/15")
    }
  )
);
Implementers

Constructors

DataSet(String? name)
DataSet.empty()

Properties

hashCode int
The hash code for this object.
read-onlyinherited
name String?
Name of this DataSet.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited

Methods

clear() → void
Clear the data. The set schema information will not be cleared.
clone([bool isDeep = false]) DataSet
Clone the data.
cloneEmpty() DataSet
createNestedRecord(String name) Record
Creates a nested Record with the specified name.
createNestedRecordList(String name) RecordList
Creates a nested RecordList with the specified name.
fromList(Map<String, dynamic>? map, {bool isListHeader = true, bool isListRecordList = true}) DataSet
Read DataSet from the Map which has Record and RecordList expressed in List format.
fromMap(Map<String, Object?>? map) DataSet
Read DataSet from the Map which has Record and RecordList expressed in Map format.
getHeader([String? name]) Record?
Get the header of the specified name.
getRecordList([String? name]) RecordList?
Get the list of the specified name.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
setHeader(Record record, [String? name]) → void
Set the header of the specified name to the specified value.
setHeaderSchema(RecordSchema schema, [String? name]) → void
Define the schema of the header part Record, which is a one-dimensional data structure.
setNestedRecordListSchema(RecordSchema schema, String name) → void
Define a schema for RecordList to be nested as a field in Record or RecordList.
setNestedRecordSchema(RecordSchema schema, String name) → void
Define a schema for Record to be nested as a field in Record or RecordList.
setRecordList(RecordList list, [String? name]) → void
Set the lsit of the specified name to the specified value.
setRecordListSchema(RecordSchema schema, [String? name]) → void
Define the schema of the list part RecordList, which is a two-dimensional data structure.
toList({bool hasNull = true, bool isOutputSchema = false, bool toJsonType = false, bool isListHeader = true, bool isListRecordList = true}) Map<String, Object>
Outputs a map with Record and RecordList expressed in List format.
toMap({bool hasNull = true, bool isOutputSchema = false, bool toJsonType = false}) Map<String, Object>
Outputs a map with Record and RecordList expressed in Map format.
toString() String
A string representation of this object.
inherited

Operators

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