Advertisement
jamilchan

Dealing with List Flutter

Mar 16th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. List<History> dataFromLocal;
  2.  
  3. List<Calc> calc = <Calc>[
  4. const Calc(calculation: '1x222', result: '222'),
  5. const Calc(calculation: '1x222', result: '222'),
  6. const Calc(calculation: '1x222', result: '222'),
  7. const Calc(calculation: '1x222', result: '222'),
  8. ];
  9.  
  10. List<Calc> calc2 = <Calc>[
  11. const Calc(calculation: '2x222', result: '444'),
  12. const Calc(calculation: '2x222', result: '444'),
  13. const Calc(calculation: '2x222', result: '444'),
  14. const Calc(calculation: '2x222', result: '444'),
  15. ];
  16.  
  17. List<Calc> calc3 = <Calc>[
  18. const Calc(calculation: '3x222', result: '666'),
  19. const Calc(calculation: '3x222', result: '666'),
  20. const Calc(calculation: '3x222', result: '666'),
  21. const Calc(calculation: '3x222', result: '666'),
  22. ];
  23.  
  24. /*
  25. List<History> history = <History>[
  26. const History(date: '16 Maret', list: ),
  27. ];
  28.  
  29. */
  30.  
  31. History addHistory(String _date, List<Calc> _listcalc) {
  32. History todayHistory = new History(
  33. date: _date,
  34. listcalc: _listcalc
  35. );
  36.  
  37. return todayHistory;
  38. }
  39.  
  40. Map generateItems(calc, res) {
  41. Map<String, String> items = {'calculation': calc, 'result': res};
  42.  
  43. return items;
  44. }
  45.  
  46.  
  47.  
  48. List<Map> addToHistory(String calc, String res) {
  49. List<Map> theList = <Map>[
  50. generateItems(calc, res),
  51. ];
  52. }
  53.  
  54. String now = new DateTime.now().toString();
  55.  
  56. /*
  57. List<History> makeAHistory(String now, List<Calc> theListCalc) {
  58. List<History> theHistory = <History>[
  59. const History(
  60. date: now,
  61. listcalc: theListCalc,
  62. )
  63. ];
  64. }
  65.  
  66. Map theMap = generateItems('2x222', '444');
  67. List<Map> historyaday = generateItems('2x222', '444');
  68.  
  69. List<History> theHistory = <History>[
  70. const History(
  71. date: now,
  72.  
  73. )
  74. ];
  75. */
  76.  
  77. //print(generateItems(theKey, theVal));
  78.  
  79. //List<Map> listOfCalc;
  80. //listOfCalc.add(generateItems('2x33', '66'));
  81.  
  82. History date16 = addHistory('Maret 16', calc);
  83. History date17 = addHistory('Maret 17', calc);
  84. History date18 = addHistory('Maret 18', calc);
  85.  
  86. dataFromLocal = <History>[
  87. date16,
  88. date17,
  89. date18
  90. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement