mirai_framework 0.0.3 copy "mirai_framework: ^0.0.3" to clipboard
mirai_framework: ^0.0.3 copied to clipboard

A local package containing Mirai framework files

example/README.md

Example #

  1. Import mirai_framework.dart at the top of your parser file.
 import 'package:mirai_framework/mirai_framework.dart';
  1. Initialize your custom parser for a widget or an action and extend it from MiraiParser or MiraiActionParser like this.

        // define `MyCustomWidget`
       
        @freezed
        class MyCustomWidget with _$MyCustomWidget { ... }
    

    a. Let's say we are initializing a widget parser.

    class MiraiWidgetPraser extends MiraiParser<MyCustomWidget> { 
        ... 
    }
    

    b. Let's say we are initializing an action parser.

    class MiraiActionPraser  extends MiraiActionParser<dynamic> {
        ...
    }
    
  2. Now implement the required methods in your custom parser.

    a. Let's say we are building a widget parser.

    class MiraiWidgetParser  extends MiraiParser<MyCustomWidget> {
        @override
        MyCustomWidget getModel(Map<String, dynamic> json) {
            // TODO: implement getModel
            throw UnimplementedError();
        }
    
        @override
        Widget parse(BuildContext context, MyCustomWidget model) {
            // TODO: implement parse
            throw UnimplementedError();
        }
    
        @override
        // TODO: implement type
        String get type => throw UnimplementedError();
    
    }
    
    

    b. Let's say we are building an action parser.

    class MiraiActionPraser  extends MiraiActionParser<dynamic> {
        @override
        // TODO: implement actionType
        String get actionType => throw UnimplementedError();
    
        @override
        getModel(Map<String, dynamic> json) {
            // TODO: implement getModel
            throw UnimplementedError();
        }
    
        @override
        FutureOr onCall(BuildContext context, model) {
            // TODO: implement onCall
            throw UnimplementedError();
        }
    }
    
5
likes
140
points
277
downloads

Publisher

verified publisherbuildmirai.dev

Weekly Downloads

A local package containing Mirai framework files

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on mirai_framework