global_wings 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • new53

Global Wings

Fast, enjoyable, declaratively and functionally variables management in flutter

You can also view a video demonstration if are a video person

πŸ›ΈπŸ›ΈπŸ›ΈπŸ›Έ Variables fly πŸ˜ƒ with Global Wings πŸ›ΈπŸ›ΈπŸ›ΈπŸ›Έ #

Global Wings #

An awesome Flutter package to share data across widgets and services without having to pass them directly.

Inspiration #

This package is inspired from javascript way of storing objects in map like structures and redux way of making state global.

Usage #

You can use global_wings to manage variables as follows. Let us imagine a complex scenariao where global_wings shines. We have have an alert dialog collecting input and we want alert to contact back to its caller to do so we may need to define variables and objects in class which is kind of bug prone and messy but with global_wings you can do it as

// In AlertBox
alertResponeCollectedByDialog() {
  save('alertResponsePermissionAccepted', true);
}
// In CallerWidget
whenNeedToAccessData() {
  if (serve('alertResponsePermissionAccepted')) {
    // Make user exit app

  } else {
    // Make user enter app
  }
}

  logCompleteStore() ;

You may need to watch complete state of your app for debugging purposes using global_wings to do so

  // It displays data in a nicely formatted way
  logCompleteStore() ;

You may also save multiple data in global_wings to do so

  saveMultiple({'name':'Chetan' , 'favouriteGame':'Badminton'});

You can also make different containers for saving data in global_wings to do so

  useStore('cart') ;
    // Save and retreive Data related to store
  useStore('product') ;
    // Save and retreive Data related to product

Global Wings ❀️ Flutter #

Global Wings was written with Flutter in mind. It is a perfect fit for managing primitive variables that don't need type inference like strings and ints:

Licence #

Copyright 2020 Chetan Jain

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[0.0.1] - June 4 2020 #

  • Created store_ds to manage state of program declaratively and functionally.

[1.0.0] - June 5 2020 #

  • Added feature for multiple store "Added feature for multiple store"

[1.0.1] - June 5 2020 #

  • Added example

[1.0.2] - June 5 2020 #

  • Fixed Bugs

[1.0.3] - June 5 2020 #

  • Added features

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    useStore('cart') ;
    // Save Data related to store 
    useStore('product') ;
    // Save Data related to product 
     
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Dev Delight'),
        ),
        body: Home(),
      ),
    );
    
  }
}



final textdecor = InputDecoration(
    fillColor: Colors.white,
    border: OutlineInputBorder(
        borderRadius: BorderRadius.circular(25.0), borderSide: BorderSide()));

class Home extends StatelessWidget {
  const Home({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final formKey = GlobalKey<FormState>();
    return Form(
      key: formKey,
      child: Column(
        children: [
          TextFormField(
            decoration: textdecor.copyWith(labelText: 'Name'),
            onSaved: (value) => {save('name', value)},
          ),
          SizedBox(
            height: 10,
          ),
          TextFormField(
            decoration: textdecor.copyWith(labelText: 'Favorite Game'),
            onSaved: (value) => {save('game', value)},
          ),
          MaterialButton(
              child: Text('Save'),
              onPressed: () {
                formKey.currentState.save();
                final snackbar = SnackBar(content: Text(serve('game')));
                Scaffold.of(context).showSnackBar(snackbar);
              })
        ],
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  global_wings: ^1.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:global_wings/global_wings.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on Jul 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Analysis suggestions

Package not compatible with SDK dart

because of import path [global_wings] that is in a package requiring null.

Health issues and suggestions

Document public APIs. (-1 points)

21 out of 21 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
Dev dependencies
flutter_test