Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

dart

var values = [
    {'userId': 1, 'rating': 4.5},
    {'userId': 2, 'rating': 4.0},
    {'userId': 3, 'rating': 3.5},
    {'userId': 4, 'rating': 3.0}
  ];

  var result = values.map((m) => m['rating']).reduce((a, b) => a + b) / values.length;
  print(result);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dart
ADD COMMENT
Topic
Name
9+4 =