fromRow method
Linha de banco → post.
Implementation
BlogPost fromRow(Map<String, Object?> r) {
final slug = '${r['slug'] ?? r['id'] ?? ''}';
return BlogPost(
slug: slug,
title: (r['title'] as String?) ?? slug,
subtitle: _str(r['subtitle']),
description: (r['description'] as String?) ?? '',
date: _date(r['date']),
bodyMarkdown: (r['body'] as String?) ?? '',
author: _str(r['author']),
image: _str(r['image']),
category: _str(r['category']) != null
? Category.parse(r['category'].toString())
: null,
tags: _tags(r['tags']),
draft: _bool(r['draft']),
views: _int(r['views']),
);
}