flutter_meedu 7.2.0 copy "flutter_meedu: ^7.2.0" to clipboard
flutter_meedu: ^7.2.0 copied to clipboard

outdated

A powerful State Management, Dependency Injection, Reactive programming and Navigation for Flutter apps.

[7.1.0] #

  • Updated to meedu: ^7.2.0

[7.1.0] #

  • Added Provider class to be able to create providers that don't depend of SimpleNotifier or StateNotifier.
  • Allow afterFirstLayout to be overridden with FutureOr.
  • Allow dispose on SimpleNotifier and StateNotifier to be overridden with FutureOr.

Example:

class HomeProviders {
  HomeProviders._();

  /// a Provider<TabController> that can be used
  /// using `HomeProviders.tabController.read`
  static final tabController = Provider(
    (ref) {
      final controller = ref.arguments as TabController;
      ref.onDispose(
        controller.dispose,
      );
      return controller;
    },
    autoDispose: false,
  );
}



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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage>
    with SingleTickerProviderStateMixin {
  @override
  void initState() {
    super.initState();
    HomeProviders.tabController.setArguments(
      TabController(
        length: 2,
        vsync: this,
      ),
    );
  }

  @override
  void dispose() {
    HomeProviders.tabController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: const CustomTabBar(),
      body: SafeArea(
        child: TabBarView(
          controller: HomeProviders.tabController.read,
          children: [
            Center(
              child: Text('Home tab'),
            ),
            Center(
              child: Text('Profile tab'),
            )
          ],
        ),
      ),
    );
  }
}

class CustomTabBar extends StatelessWidget with PreferredSizeWidget {
  const CustomTabBar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return AppBar(
      bottom: TabBar(
        controller: HomeProviders.tabController.read,
        tabs: [
          Tab(
            text: 'Home',
            icon: Icon(Icons.home),
          ),
          Tab(
            text: 'Profile',
            icon: Icon(Icons.person),
          ),
        ],
      ),
    );
  }

  @override
  Size get preferredSize => Size.fromHeight(kToolbarHeight * 2);
}

[7.0.0] #

  • BREAKING CHANGE

    imports has been renamed.

    Before:

    import 'package:flutter_meedu/router.dart';
    import 'package:flutter_meedu/rx.dart';
    import 'package:flutter_meedu/state.dart';
    import 'package:flutter_meedu/page.dart';
    import 'package:flutter_meedu/navigation.dart';
    import 'package:flutter_meedu/screen_utils.dart';
    

    Now:

    import 'package:flutter_meedu/ui.dart'; /// this contains the all previous libraries in one single import
    

    IMPORTANT: package:flutter_meedu/flutter_meedu.dart has been removed in favor to package:flutter_meedu/ui.dart

  • BREAKING CHANGE

    Now to use the route module you don't have to use alias. Now you have to use the global var router

    Before:

    import 'package:flutter_meedu/router.dart' as router;
    
    MaterialApp(
      navigatorKey: router.navigatorKey,// <-- ADD THIS
      home: HomePage(),
      navigatorObservers: [
        router.observer,// <-- ADD THIS
      ],
      .
      .
      .
    ),
    

    Now:

    import 'package:flutter_meedu/ui.dart'; // Alias is not needed any more
    
    MaterialApp(
      navigatorKey: router.navigatorKey,// <-- ADD THIS
      home: HomePage(),
      navigatorObservers: [
        router.observer,// <-- ADD THIS
      ],
      .
      .
      .
    ),
    
  • BREAKING CHANGE:

    Get.factoryPut<T,A> has been replaced for Get. factoryPut<T>

    Before:

    Get.factoryPut<AuthRepository, String>(
      (String? arguments) => AuthRepository (arguments!),
    );
      .
      .
      .
    final testRepo = Get.factoryFind<AuthRepository,  String>(
    arguments:"https://test.api.com",
    );
    

    Now:

    Get.factoryPut<AuthRepository>(
      (arguments) => AuthRepository(arguments as  String),
    );
      .
      .
      .
    final testRepo = Get.factoryFind<AuthRepository>(
    arguments:"https://test.api.com",
    );
    
  • Added AfterFirstLayoutMixin. Add with AfterLayoutMixin

    class MyWidget extends StatefulWidget {
      const _MyWidget({Key? key}) : super(key: key);
      @override
      State<MyWidget> createState() => _MyWidgetState();
    }
    
    class _MyWidgetState extends State<MyWidget> with AfterFirstLayoutMixin {
      @override
      void afterFirstLayout(BuildContext context) {
        showDialog(
          context: context,
          builder: (_) => AlertDialog(
            content: Text('after first layout'),
          ),
        );
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold();
      }
    }
    
  • Added Get.asyncPut<T>:

    Example:

     Get.asyncPut<Person>(
        (arguments) async {
          await Future.delayed(
            const Duration(milliseconds: 10),
          );
          return Person(arguments as String);
        },
    );
    .
    .
    .
    final person = await Get.asyncFind<Person>  (arguments: 'Darwin');
    

[6.2.5+1] #

  • Added export 'src/navigation/transitions/transition.dart'; in navigator library.

[6.2.5] #

  • Export Navigator1 as an independent library.
  • Added ContextNavigatorExt extension.

[6.2.4] #

  • Added class Navigator1 to easy use push, pushReplacement, pushAndRemoveUntil and all pop methods.

[6.2.3] #

  • Updated to meedu: ^5.3.1

[6.2.2] #

  • Updated to meedu: ^5.3.0

[6.2.1] #

  • Updated to meedu: ^5.2.0

[6.2.0] #

  • Updated to meedu: ^5.2.0

[6.1.0] #

  • Updated to meedu: ^5.1.0
  • Added PersistentStateMixin to save the state of your StateNotifers as a JSON.

[6.0.1] #

  • Fixed bug due to addPostFrameCallback in ConsumerWidget when an update is called before addPostFrameCallback has been completed.

[6.0.0] #

  • Release 6.x.x

[6.0.0-dev.2] #

  • Removed deprecated methods.

[6.0.0-dev.1] #

  • Set min dark sdk >=2.15

[6.0.0-dev.0] #

BREAKING CHANGE: removed .ids filter in favor to .select in SimpleProvider.

[5.3.1] #

  • Added @Deprecated annotation for .ids filter, that filter will be removed in flutter_meedu: ^6.x.x.

  • Updated to meedu: ^4.3.0

[5.3.0+1] #

  • Updated README.md

[5.3.0] #

  • Added support for filters in ProviderListener and MultiProviderListener

For example:

ProviderListener<CounterController>(
  provider: counterProvider.select(
    (_) => _.counter >= 5,
  ),
  onChange: (_, controller) {

  },
  builder: (_, controller) {
    return YOUR_WIDGET;
  },
);
  • Added lint rules.

[5.2.1] #

  • Added router.context.

[5.2.0+1] #

  • Updated readme.

[5.2.0] #

  • Added validations for bad use of ref.watch and ref.select.

[5.1.0] #

  • now the router module allows you access to the route arguments without BuildContext. To do this you need to add the observer in your navigatorObservers.
import 'package:flutter_meedu/router.dart' as router;

MaterialApp(
  navigatorKey: router.navigatorKey,// <-- ADD THIS
  home: HomePage(),
  navigatorObservers: [
    router.observer,// <-- ADD THIS
  ],
  .
  .
  .
),

then you can access to the route setting or arguments

import 'package:flutter_meedu/router.dart' as router;
.
.
.
// now you can use
final arguments = router.arguments;

/// current route settings
final settings = router.settings;

.
.
.
/// also you can pass directly the route arguments to your controllers
final counterProvider = SimpleProvider(
  (_) => CounterController(router.arguments as int),
);

or

final counterProvider = SimpleProvider<CounterController>(
  (_) {
    final initialValue = router.arguments as int;
    return CounterController(initialValue);
  },
);


/// if you need to write unit or widget testing
/// you can use the [overrideProvider] method
setUp((){
  counterProvider.overrideProvider(
    (_) => CounterController(mockedInitialValue),
  );
});

[5.0.1] #

  • Updated to meedu: ^4.2.1

[5.0.0] #

  • BREAKING CHANGE: Removed ScopedReader and replaced by BuilderRef.

Before: the watch function allways return the notifier linked to the provider passed as parameter to the watch function.

 Consumer(builder: (_, watch, __) {
     final controller = watch(counterProvider);
     return Text("${controller.counter}");
 })
 Consumer(builder: (_, watch, __) {
     final controller = watch(
       counterProvider.select((_) => _.counter),
     );
     return Text("${controller.counter}");
 })

After: now the consumer widget has replaced the watch parameter for one instance of BuilderRef with this change to listen the changes you need to use ref.watch

 Consumer(builder: (_, ref, __) {
     final controller = ref.watch(counterProvider);
    return Text("${controller.counter}");
 })

// or

 Consumer(builder: (_, ref, __) {
     final controller = ref.watch(
       counterProvider.select((_) => _.counter),
     );
    return Text("${controller.counter}");
 })

or if you want direct access to the value returned by counterProvider.select((_) => _.counter) you can use ref.select

 Consumer(builder: (_, ref, __) {
     final int counter = ref.select(
       counterProvider.select((_) => _.counter),
     );
    return Text("$counter");
 })
  • ref.watch can be used to listen the changes in a provider even you can use filters like .ids, .select and .when with ref.watch but it allways returns the notifier linked to the provider.

  • ref.select can be used to listen the changes in a provider only using filters like .select and .when and the value returned by ref.select depends of the value returned by the filters.

IMPORTANT: the .ids filter only should be used with ref.watch.

#

[4.4.1] #

  • Fixed multiples rebuilds with custom transitions using named routes.

[4.4.0] #

  • Added MultiProviderListener widget.

[4.3.0] #

  • Added autoRemove and onRemove in dependency injection.

[4.2.1] #

  • Added result parameter in pushReplacementNamed.

[4.2.0] #

  • Added custom transitions for named routes.
  • Updated docs.

[4.1.1] #

  • Added isDarkMode extension.

[4.1.0+3] #

  • Added const constructor in PageWithArgumentsWidget class.

[4.1.0+2] #

  • Added const constructor in PageWithArgumentsWidget class.

[4.1.0+1] #

  • Added PageWithArgumentsWidget class.

[4.1.0] #

  • Updated to meedu: ^4.1.0

[4.0.0+2] #

  • Updated to meedu: ^4.0.0+1
  • Improved ConsumerWidget class.

[4.0.0+1] #

  • Added comments in the consumer widget.

[4.0.0-dev.0] #

  • Removed WatchFilter class.
  • Added .ids, .select and .when methods in SimpleProvider and StateProvider.

[3.0.10] #

  • Added PageWithArguments Widget.

[3.0.9] #

  • Updated to meedu: ^3.0.8

[3.0.8+1] #

  • Updated README.

[3.0.8] #

  • Updated to meedu: ^3.0.7

[3.0.7] #

  • Updated to meedu: ^3.0.6
  • Added lint rules.

[3.0.6] #

  • Updated to meedu: ^3.0.5

[3.0.5] #

  • Updated Navigator Observer.

[3.0.4] #

  • Updated to meedu: ^3.0.4

[3.0.3] #

  • Updated to meedu: ^3.0.2

[3.0.2] #

  • Updated tests

[3.0.1] #

  • Updated to meedu: ^3.0.1

[3.0.0+1] #

  • Updated README.MD

[3.0.0] #

  • Ready for production

[3.0.0-prev.22] #

  • Updated to meedu: ^3.0.0-prev.15

[3.0.0-prev.21] #

  • Updated to meedu: ^3.0.0-prev.14
  • call AutoDispose after route dismiss animation.

[3.0.0-prev.20] #

  • Added dispose method in router module.

[3.0.0-prev.19] #

  • Updated to meedu: ^3.0.0-prev.13

[3.0.0-prev.18] #

  • Updated to meedu: ^3.0.0-prev.11

[3.0.0-prev.17] #

  • Removed Logs on Consumer widget.

[3.0.0-prev.16] #

  • ProviderListener onChange callback is called after next frame.

[3.0.0-prev.15] #

  • Fixed routeName on NavigatorObserver.

[3.0.0-prev.14] #

  • Fixed Provider widget.

[3.0.0-prev.13] #

  • Added WatchFilter class.

[3.0.0-prev.12] #

  • Added buildWhen, buildByIds and buildBySelect in the watch method of ConsumerWidget.

[3.0.0-prev.11] #

  • fixed router.arguments.

[3.0.0-prev.10] #

  • Fixed autoDispose in pushAndRemoveUntil usinf didRemove.

[3.0.0-prev.9] #

  • Fixed autoDispose in pushAndRemoveUntil.

[3.0.0-prev.8] #

  • fixed autoDispose for multiples providers.

[3.0.0-prev.7] #

  • fixed autoDispose when navigate using Navigator.push(...).

[3.0.0-prev.6] #

  • meedu: ^3.0.0-prev.5

[3.0.0-prev.5] #

  • meedu: ^3.0.0-prev.4

[3.0.0-prev.4] #

  • meedu: ^3.0.0-prev.3

[3.0.0-prev.3] #

  • meedu: ^3.0.0-prev.2

[3.0.0-prev.2] #

  • Fixed read method into ProviderReference.

[3.0.0-prev.1] #

  • Added events to ProviderListener.

[3.0.0-prev.0] #

  • Prev version of 3.0.0

[2.1.1] #

  • Fixed router navigator key.

[2.1.0-prev.1] #

  • Updated export file.

[2.1.0-prev.0] #

  • Updated meedu: ^2.1.0

[2.0.1] #

  • Updated meedu: ^2.0.1

[2.0.0] #

  • Added support for flutter 2 and null safety.

[1.1.2] #

  • Fixed push with Generic types.

[1.1.1] #

  • Updated meedu: ^0.5.4.

[1.1.0] #

  • Added tag support for Provider.of<...>(...)

[1.0.5] #

  • Removed unused imports.

[1.0.4] #

  • Fixed route.arguments in ProviderPage.

[1.0.3+2] #

  • Updated meedu version.

[1.0.3+1] #

  • Added documentation url.

[1.0.3] #

  • Added ProviderPage.

[1.0.2] #

  • Added SimpleWidget and StateWidget.

[1.0.1] #

  • Added screen utils.

[1.0.0] #

  • initial version.
135
likes
0
pub points
84%
popularity

Publisher

verified publishermeedu.app

A powerful State Management, Dependency Injection, Reactive programming and Navigation for Flutter apps.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, meedu

More

Packages that depend on flutter_meedu