| OLD | NEW |
| 1 /** | 1 /** |
| 2 * Mock implementation of the data service library. | 2 * Mock implementation of the data service library. |
| 3 */ | 3 */ |
| 4 library dataservice; | 4 library dataservice; |
| 5 | 5 |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 | 7 |
| 8 // List of fake companies | 8 // List of fake companies |
| 9 List _companies = [ | 9 List _companies = [ |
| 10 { | 10 { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 /// simulate an RPC call to fetch companies | 42 /// simulate an RPC call to fetch companies |
| 43 Future<List<Map>> fetchCompanies(String query) => | 43 Future<List<Map>> fetchCompanies(String query) => |
| 44 new Future.delayed(new Duration(milliseconds: 500), () => | 44 new Future.delayed(new Duration(milliseconds: 500), () => |
| 45 _companies.where((company) => | 45 _companies.where((company) => |
| 46 company['name'].toLowerCase().indexOf(query.toLowerCase()) > -1)); | 46 company['name'].toLowerCase().indexOf(query.toLowerCase()) > -1)); |
| 47 | 47 |
| 48 /// simulate an RPC call to fetch a company | 48 /// simulate an RPC call to fetch a company |
| 49 Future<Map> fetchCompany(int id) => | 49 Future<Map> fetchCompany(int id) => |
| 50 new Future.delayed(new Duration(seconds: 1), () => | 50 new Future.delayed(new Duration(seconds: 1), () => |
| 51 _companies.firstWhere((c) => c['id'] == id, orElse: () => null)); | 51 _companies.firstWhere((c) => c['id'] == id, orElse: () => null)); |
| OLD | NEW |