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

retracted[pending analysis]

A flutter package to do work in another isolate to render the ui

example/isolate_builder_example.dart

import 'package:flutter/material.dart';
// import 'package:flutter/widgets.dart';
import 'package:isolate_builder/isolate_builder.dart';
import 'package:somehow_i_manage/somehow_i_manage.dart';

Future<void> main() async {
  runApp(const MainTest());
}

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

  @override
  State<MainTest> createState() => _MainTestState();
}

class _MainTestState extends State<MainTest> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        const Text("Isolate Example"),
        IsolateBuilder<int>(
          builder: (IWorker iWorker, IWorkStatus status) {
            switch (status) {
              case IWorkStatus.undone:
                return Container(
                  color: Colors.grey,
                  child: Text(status.name),
                );
              case IWorkStatus.active:
                return Container(
                  color: Colors.blue,
                  child: Text(status.name),
                );
              case IWorkStatus.success:
                return Container(
                  color: Colors.green,
                  child: Text(status.name),
                );
              case IWorkStatus.failed:
                return Container(
                  color: Colors.red,
                  child: Text(status.name),
                );
            }
          },
          work: () async {
            await Future.delayed(const Duration(seconds: 10));
            return 1 + 1;
          },
        ),
      ],
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A flutter package to do work in another isolate to render the ui

Repository (GitHub)
View/report issues

License

(pending) (license)

Dependencies

flutter, somehow_i_manage

More

Packages that depend on isolate_builder