Created with <3 with dartpad.dev.
Created
October 30, 2023 05:29
-
-
Save nitaking/3f4cc8636f64a6630742c6584678a296 to your computer and use it in GitHub Desktop.
rustic-sunshine-3259
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
class User { | |
final int id; | |
final String name; | |
const User({ | |
required this.id, | |
required this.name, | |
}); | |
} | |
List<User> users = [ | |
User( id: 1, name: 'yamada' ), | |
User( id: 2, name: 'suzuki' ), | |
User( id: 3, name: 'hogehoge') | |
]; | |
void main(){ | |
users.asMap().forEach((index, user){ | |
print('index: $index, id: ${user.id}, name: ${user.name}'); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment