flutter_driver_fast_restart 0.0.1

Flutter Android iOS web

Fast driver test restart.

example/main.dart

import 'package:flutter_driver_fast_restart/flutter_driver_fast_restart.dart';
import 'package:flutter_driver_fast_restart/flutter_driver_extensions.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_driver/driver_extension.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
import 'package:flutter_driver/flutter_driver.dart';

void main() async {
  final restartController = RestartController();
  enableFlutterDriverExtension(handler: (request) async {
    restartController.add(request);
    return ""; // Return any String result you might need.
  });
  timeDilation = 0.01; // you might want to change dilation to speedup e2e tests
  runApp(RestartWidget(
    restartController: restartController,
    builder: (context, data) => MyApp(data: data),
  ));

  // Somewhere in your tests
  final driver = await FlutterDriver.connect();

  driver.restart("some configuration");

  // Close the driver when unnecessary.
  driver.close();
}

class MyApp extends StatelessWidget {
  final String data;

  const MyApp({Key key, @required this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        body: Center(
          child: Text("Hello world! $data"),
        ),
      ),
    );
  }
}