Taxi booking in Flutter - locationviewmodel.dart

 Create a new dart file named as 'locationviewmodel.dart in lib -> viewmodels folder and paste following code.

Create a Taxi Booking Project in flutter

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, Gujarat 395010',
          Spot1: 'Entrance Gate',
          Spot2: 'Exit Gate'


      ),
      LocationModel(
        Name: 'Howrah Bridge',
        Img:
            'https://assets.traveltriangle.com/blog/wp-content/uploads/2015/06/Udaivilas-Palace.jpg',
        Distance: '55 km',
        Rate: '80.0',
        Address: '1A, Bombay Market-Punagam Rd, Krishnakunj Society, Punagam, Varachha, Surat, Gujarat 395010',
        Spot1: 'Entrance Gate',
        Spot2: 'Exit Gate'

      ),
      LocationModel(
        Name: 'Vidyasagar Setu',
        Img:
            'https://images.hindustantimes.com/img/2022/12/03/original/fbdf0039359861ef8026921ab8fd5382_1670055785607.jpg',
        Distance: '70 km',
        Rate: '80.0',
        Address: '1A, Bombay Market-Punagam Rd, Krishnakunj Society, Punagam, Varachha, Surat, Gujarat 395010',
          Spot1: 'Entrance Gate',
          Spot2: 'Exit Gate'

      ),
      LocationModel(
        Name: 'Udaivilas Palace',
        Img:
            'https://assets.traveltriangle.com/blog/wp-content/uploads/2015/06/Udaivilas-Palace.jpg',
        Distance: '20 km',
        Rate: '80.0',
        Address: '1A, Bombay Market-Punagam Rd, Krishnakunj Society, Punagam, Varachha, Surat, Gujarat 395010',
          Spot1: 'Entrance Gate',
          Spot2: 'Exit Gate'

      ),
    ];
    notifyListeners();
  }
}

Go to Main project

Comments

Popular posts from this blog

Push Notifications in .NET MAUI: A Comprehensive Guide

Explore the UI libraries available for .NET MAUI at no cost.

Push Notification using Firebase in xamarin form (Android and IOS)