handlerz 0.0.1+3 copy "handlerz: ^0.0.1+3" to clipboard
handlerz: ^0.0.1+3 copied to clipboard

this project is for handling error in flutter, and still upgrading for better performance and easy to use

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:handlerz/handlerz.dart';
import 'kelas.dart';

Handlerz controller = Handlerz();

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {


    controller.set([
      Kelas.state,
    ]);

    controller.setErrorHandler<Kelas>((error) {
      print('custom error handler');
    });

    controller.getAsync<Kelas>((c) {
      c.getDataFromApi();
    });


  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: ${controller.get<Kelas>((c) {return c.getData();}) ?? ''}\n'),
        ),
      ),
    );
  }
}
0
likes
0
points
14
downloads

Publisher

unverified uploader

Weekly Downloads

this project is for handling error in flutter, and still upgrading for better performance and easy to use

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on handlerz

Packages that implement handlerz