stac_framework 0.2.1 copy "stac_framework: ^0.2.1" to clipboard
stac_framework: ^0.2.1 copied to clipboard

The Stac Framework enables easy creation of parsers for widgets and actions, enhancing Stac's functionality and supporting custom implementations.

example/README.md

Example #

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

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

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

    class StacWidgetPraser extends Parser<MyCustomWidget> { 
        ... 
    }
    

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

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

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

    class StacWidgetParser  extends StacParser<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 StacActionPraser  extends StacActionParser<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();
        }
    }
    
7
likes
0
points
11.9k
downloads

Publisher

verified publisherstac.dev

Weekly Downloads

The Stac Framework enables easy creation of parsers for widgets and actions, enhancing Stac's functionality and supporting custom implementations.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on stac_framework