hailify 0.0.2 copy "hailify: ^0.0.2" to clipboard
hailify: ^0.0.2 copied to clipboard

Flutter Hailify sdk to use the end to end delivery flow inside your flutter client application.

example/lib/main.dart

import 'dart:async';
import 'dart:developer';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hailify/hailify.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    try {
      Hailify.initilize("<fleet-name>",
          "<fleet-token>");
      Hailify.enableSandbox(true);
      Hailify.useSDKLocationEngine(true);
      Hailify.setDriverId("<driver-id>");

      //Hailify.setLocation(latitude, longitude, accuracy);
      Hailify.initializeDeliveryView(() => {
        Hailify.setMaxHeightPercentage(90)
      });
      Hailify.setCallListener(
              (number) => {

          });
      Hailify.setOrderStatusListener((orderStatus, orderId) => {});

      Hailify.setNavigationListener((latitude, longitude) => {
        log("setNavigationListener : " +
            latitude.toString() +
            " " +
            longitude.toString())
      });

      Hailify.setCompleteListener(() => {log("completion of order")});

      // Call showOrderPopup() only after assign the job order to the user.
      Hailify.showOrderPopup();

      // getCUrrent order status  will give you the current order status.
      Hailify.getCurrentOrderStatus.then((status) => {
        log("Currenet Order Status: " + status.toString())
      });
    } on PlatformException {}
  }

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: TextButton(child: Text('Hello World'), onPressed: null),
        ),
      ),
    );
  }
}
0
likes
145
points
13
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter Hailify sdk to use the end to end delivery flow inside your flutter client application.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on hailify

Packages that implement hailify