mirrored_repositories/Login_BloC/lib/src
import 'package:flutter/material.dart';
import 'bloc.dart';

class Provider extends InheritedWidget {
  final bloc = Bloc();

  //let Provider wrap a widget which will use scoped pattern
  Provider({Key key, Widget child}) : super(key: key, child: child);

  bool updateShouldNotify(_) => true;

  //該方法簡單來說就是讓該widget底下的任意widget都可以連結到Provider, 來對Bloc做存取
  static Bloc of(BuildContext context) {
    return (context.inheritFromWidgetOfExactType(Provider) as Provider).bloc;
  }
}
