Group By Dart

Group By Dart :

Group By Dart
import "package:collection/collection.dart";

main(List<String> args) {
  var data = [
    {"title": 'Android', "release_date": '10/01/2019'},
    {"title": 'Flutter Tutorial', "release_date": '10/01/2019'},
    {"title": 'Java', "release_date": '30/10/2019'},
  ];

  var groupByData = groupBy(data, (obj) => obj['release_date']);
  //var newMap = groupBy(data, (obj) => obj['release_date'] == "10/01/2019");

  print(groupByData);
}

/*
{
  10/01/2019: [
    {
      title: Android,
      release_date: 10/01/2019
    },
    {
      title: FlutterTutorial,
      release_date: 10/01/2019
    }
  ],
  30/10/2019: [
    {
      title: Java,
      release_date: 30/10/2019
    }
  ]
}
*/