Posts

Showing posts with the label #viewmodel

Taxi booking in Flutter - locationviewmodel.dart

Image
 Create a new dart file named as 'locationviewmodel.dart in lib -> viewmodels folder and paste following code. Please, support my blog by clicking on our sponsors ad! import 'package:flutter/cupertino.dart'; import 'package:myfirstproject/models/AreaSpotModel.dart'; import 'package:myfirstproject/models/locationmodel.dart'; class LocationViewModel extends ChangeNotifier { List<LocationModel> _list = []; List<LocationModel> get locationList => _list; set locationList(List<LocationModel> value) { _list = value; } void GetData() { locationList = [ LocationModel( Name: 'Mugal Garden', Img: 'https://images.hindustantimes.com/img/2022/12/03/original/fbdf0039359861ef8026921ab8fd5382_1670055785607.jpg', Distance: '25 km', Rate: '80.0', Address: '1A, Bombay Market-Punagam Rd, Krishnakunj Society, Punagam, Varachha, Surat...