Dart mode import 'dart:math' show Random; void main() { print(new Die(n: 12).roll()); } // Define a class. class Die { // Define a class variable. static Random shaker = new Random(); // Define instance variables. int sides, value; // Define a method using shorthand syntax. String toString() => '$value'; // Define a constructor. Die({int n: 6}) { if (4 <= n && n <= 20) { sides = n; } else { // Support for errors and exceptions. throw new ArgumentError(/* */); } } // Define an instance method. int roll() { return value = shaker.nextInt(sides) + 1; } } x 1import 'dart:math' show Random;23void main() {4 print(new Die(n: 12).roll());5}67// Define a class.8class Die {9 // Define a class variable.10 static Random shaker = new Random();1112 // Define instance variables.13 int sides, value;1415 // Define a method using shorthand syntax.16 String toString() => '$value';1718 // Define a constructor.19 Die({int n: 6}) {20 if (4 <= n && n <= 20) {21 sides = n;22 } else {23 // Support for errors and exceptions.24 throw new ArgumentError(/* */);25 }26 }2728 // Define an instance method.29 int roll() {30 return value = shaker.nextInt(sides) + 1;31 }32}33