blemulator 1.2.1 copy "blemulator: ^1.2.1" to clipboard
blemulator: ^1.2.1 copied to clipboard

Flutter plugin for simulating BLE peripherals on FlutterBleLib

example/lib/main.dart

import 'package:blemulator_example/device_details/device_detail_view.dart';
import 'package:blemulator_example/device_details/devices_details_bloc_provider.dart';
import 'package:blemulator_example/devices_list/devices_bloc_provider.dart';
import 'package:blemulator_example/devices_list/devices_list_view.dart';
import 'package:blemulator_example/navigation/bloc.dart';
import 'package:blemulator_example/navigation/route_name.dart';
import 'package:blemulator_example/navigation/router.dart';
import 'package:blemulator_example/styles/custom_colors.dart';
import 'package:blemulator_example/styles/custom_theme.dart';
import 'package:fimber/fimber.dart';
import 'package:flutter/material.dart' hide Router;
import 'package:flutter_bloc/flutter_bloc.dart';

void main() {
  Fimber.plantTree(DebugTree());
  runApp(MyApp());
}

final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();

class MyApp extends StatelessWidget {
  final GlobalKey<NavigatorState> _navigatorKey = GlobalKey();
  final bool useNewExample = false;

  @override
  Widget build(BuildContext context) {
    return useNewExample ? _buildNewExample() : _buildExample();
  }

  Widget _buildExample() {
    return MaterialApp(title: 'Blemulator example',
      theme: ThemeData(
        primaryColor: Color(0xFF0A3D91),
        accentColor: Color(0xFFCC0000),
      ),
      initialRoute: '/',
      routes: <String, WidgetBuilder>{
        '/': (context) => DevicesBlocProvider(child: DevicesListScreen()),
        '/details': (context) =>
            DeviceDetailsBlocProvider(child: DeviceDetailsView()),
      },
      navigatorObservers: [routeObserver],
    );
  }

  Widget _buildNewExample() {
    return BlocProvider<NavigationBloc>(
      create: (context) => NavigationBloc(navigatorKey: _navigatorKey),
      child: MaterialApp(
        navigatorKey: _navigatorKey,
        title: 'Blemulator example',
        theme: ThemeData(
          primaryColor: CustomColors.primary,
          accentColor: CustomColors.accent,
          scaffoldBackgroundColor: CustomColors.scaffoldBackground,
          cardTheme: CustomTheme.card,
        ),
        initialRoute: RouteName.home,
        onGenerateRoute: (settings) => Router.generateRoute(settings),
      ),
    );
  }
}
16
likes
30
points
51
downloads

Publisher

verified publisherpolidea.com

Weekly Downloads

Flutter plugin for simulating BLE peripherals on FlutterBleLib

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

async, flutter, flutter_ble_lib, meta, pedantic

More

Packages that depend on blemulator