map method

  1. @override
AppConfigData map(
  1. Map<String, dynamic> data, {
  2. String? tablePrefix,
})

Maps the given row returned by the database into the fitting data class.

Implementation

@override
AppConfigData map(Map<String, dynamic> data, {String? tablePrefix}) {
  final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
  return AppConfigData(
    id: attachedDatabase.typeMapping
        .read(DriftSqlType.int, data['${effectivePrefix}id'])!,
    updatedAt: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}updated_at'])!,
    lenderId: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}lender_id'])!,
    apiEndpoint: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}api_endpoint'])!,
    apiKey: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}api_key'])!,
    apiSecret: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}api_secret'])!,
    appBundle: attachedDatabase.typeMapping
        .read(DriftSqlType.string, data['${effectivePrefix}app_bundle'])!,
    shouldSyncData: attachedDatabase.typeMapping
        .read(DriftSqlType.bool, data['${effectivePrefix}should_sync_data'])!,
    lastSync: attachedDatabase.typeMapping
        .read(DriftSqlType.dateTime, data['${effectivePrefix}last_sync']),
  );
}