Created
August 24, 2022 19:04
-
-
Save 3t14/07c3a527380946836fe233f32f755f95 to your computer and use it in GitHub Desktop.
レコードの定義と仮のデータの代入
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// メモデータに関するモデル処理 | |
// 1件分のメモデータ | |
class Item { | |
final int id; // ユニークな識別子 | |
final String title; // メモのタイトル | |
final String memo; // メモの内容 | |
// コンストラクタ | |
const Item({ | |
this.id = -1, | |
required this.title, | |
required this.memo | |
}); | |
} | |
// 全データ | |
List<Item> items = <Item>[ | |
const Item( | |
id: 0, | |
title: 'Item 1', | |
memo: 'This is the first item.', | |
), | |
const Item( | |
id: 1, | |
title: 'Item 2', | |
memo: 'This is the second item.', | |
), | |
const Item( | |
id: 2, | |
title: 'Item 3', | |
memo: 'This is the third item.', | |
), | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment