Created
December 11, 2019 12:27
-
-
Save nicowernli/b776104e9c58da4b267ba0ab299a6b15 to your computer and use it in GitHub Desktop.
Flutter AppConfig for differente flavors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:meta/meta.dart'; | |
class AppConfig extends InheritedWidget { | |
AppConfig({ | |
@required this.flavorName, | |
@required this.apiBaseUrl, | |
@required Widget child, | |
}) : super(child: child); | |
final String flavorName; | |
final String apiBaseUrl; | |
static AppConfig of(BuildContext context) { | |
return context.inheritFromWidgetOfExactType(AppConfig); | |
} | |
@override | |
bool updateShouldNotify(InheritedWidget oldWidget) => false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment