This repository has been archived on 2023-11-13. You can view files and clone it, but cannot push or open issues or pull requests.
imagini/web_native/lib/core/app_provider.dart
2021-02-11 15:47:42 -05:00

28 lines
783 B
Dart

import 'package:flutter/material.dart';
import 'package:fluro/fluro.dart';
import 'package:imagini/core/imagini_application.dart';
class AppProvider extends InheritedWidget {
final ImaginiApplication application;
AppProvider({Key key, Widget child, this.application})
: super(key: key, child: child);
bool updateShouldNotify(_) => true;
static AppProvider of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>();
}
static FluroRouter getRouter(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>().application.router;
}
static ImaginiApplication getApplication(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<AppProvider>().application;
}
}