nb_optimization_flutter 0.0.1 copy "nb_optimization_flutter: ^0.0.1" to clipboard
nb_optimization_flutter: ^0.0.1 copied to clipboard

This package is a powerful tool that helps businesses optimize their delivery routes to maximize efficiency, save time, and reduce costs. It is designed to solve both Single and/or Multi Vehicle Routi [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:nb_navigation_flutter/nb_navigation_flutter.dart';
import 'package:nb_optimization_navigation/optimization_flutter.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';

import 'full_navigation_example.dart';
import 'optimize_route_provider.dart';
import 'step_info_page.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  static const String accessKey = String.fromEnvironment("ACCESS_KEY");

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

class _MyAppState extends State<MyApp> with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    NextBillion.initNextBillion(MyApp.accessKey);
    NextBillionOptimization.initialize(MyApp.accessKey);
    _tabController =
        TabController(length: 2, vsync: this); // Define the number of tabs
    checkPermissions();
  }

  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider<OptimizeRouteProvider>.value(
            value: OptimizeRouteProvider()),
      ],
      child: MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            centerTitle: true,
            title: const Text('Optimize Route Example'),
            bottom: TabBar(
              controller: _tabController,
              tabs: const [
                Tab(text: 'Map'),
                Tab(text: 'Step Info'),
              ],
            ),
          ),
          body: TabBarView(
            physics: const NeverScrollableScrollPhysics(),
            controller: _tabController,
            children: const [
              FullNavigationExample(),
              StepInfoPage(),
            ],
          ),
        ),
      ),
    );
  }

  @override
  void dispose() {
    _tabController.dispose();
    super.dispose();
  }

  void checkPermissions() async {
    var status = await Permission.location.status;
    if (status.isDenied) {
      await [Permission.location].request();
    }
  }
}
0
likes
130
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

This package is a powerful tool that helps businesses optimize their delivery routes to maximize efficiency, save time, and reduce costs. It is designed to solve both Single and/or Multi Vehicle Routing Problem (VRP), which is a classic optimization problem in operations research that involves finding the optimal set of routes for a fleet of vehicles to visit a set of locations while satisfying various constraints such as time windows, capacity, and vehicle availability.

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

dio, flutter, plugin_platform_interface

More

Packages that depend on nb_optimization_flutter