Created
April 22, 2024 14:39
-
-
Save fredgrott/06f1b4ae4c63564a51f8ffd869db9454 to your computer and use it in GitHub Desktop.
app globals
This file contains 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
// Copyright 2024 Fredrick Allan Hrott. All rights reserved. | |
// Use of this source code is governed by a BSD-style | |
// license that can be found in the LICENSE file. | |
import 'package:flutter/material.dart'; | |
// So this is how we will get the context to use in any models as | |
// the scaffoldMessengerKey will be supplied to the MaterialApp | |
// and then the appRouterContext will be the context referred to | |
// in the AppLocalisations.of().localizationKey call in the model | |
// as this then can be repeated when we use the MaterialApp wrapper | |
// to unit test the model in unit tests. | |
final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>(); | |
BuildContext? appRouterContext = scaffoldMessengerKey.currentContext; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment