writeToDashboardConfigDB method

FutureOr<void> writeToDashboardConfigDB(
  1. DashboardConfigWrapper dashboardConfigWrapper,
  2. Isar isar
)

Implementation

FutureOr<void> writeToDashboardConfigDB(
  DashboardConfigWrapper dashboardConfigWrapper,
  Isar isar,
) async {
  final dashboardConfig = DashboardConfigSchema()
    ..enableDashboard = dashboardConfigWrapper.enableDashboard
    ..charts = dashboardConfigWrapper.charts?.map((chart) {
      final dssChart = DashboardChartConfigSchema()
        ..name = chart.name
        ..active = chart.active
        ..chartType = chart.chartType
        ..vizType = chart.vizType;
      return dssChart;
    }).toList();

  isar.writeTxnSync(() {
    isar.dashboardConfigSchemas.putSync(dashboardConfig);
  });
}