ids property

List<String> get ids

Gets a list of IDs from the models in the list.

Example:

final models = {
  '1': Person(id: '1', name: 'John', age: 30),
  '2': Person(id: '2', name: 'Doe', age: 25),
};

final ids = models.ids;
print(ids); // ['1', '2']

Output:

['1', '2']

Implementation

List<String> get ids => [
  for (final item in values)
    if (item.id != null) item.id!,
];