1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 13:58:47 +00:00

Make the URL for the data JSON file absolute. (#902)

* Make the URL for the data JSON file absolute.

* dart format
This commit is contained in:
Brett Morgan
2021-10-07 05:44:45 +11:00
committed by GitHub
parent 5b1045187a
commit 0fe216a1cf
2 changed files with 4 additions and 3 deletions

View File

@@ -12,13 +12,13 @@ final http.Client httpClient = MockClient();
void main() { void main() {
testWidgets('sign in', (tester) async { testWidgets('sign in', (tester) async {
await _signIn(tester, 'root','password'); await _signIn(tester, 'root', 'password');
expect(find.text('Unable to sign in.'), findsNothing); expect(find.text('Unable to sign in.'), findsNothing);
expect(find.text('Successfully signed in.'), findsOneWidget); expect(find.text('Successfully signed in.'), findsOneWidget);
}); });
testWidgets('sign in with bad password', (tester) async { testWidgets('sign in with bad password', (tester) async {
await _signIn(tester, 'admin','pw'); await _signIn(tester, 'admin', 'pw');
expect(find.byType(AlertDialog), findsOneWidget); expect(find.byType(AlertDialog), findsOneWidget);
expect(find.text('Unable to sign in.'), findsOneWidget); expect(find.text('Unable to sign in.'), findsOneWidget);
expect(find.text('Successfully signed in.'), findsNothing); expect(find.text('Successfully signed in.'), findsNothing);

View File

@@ -42,7 +42,8 @@ class HState extends State<Home> {
} }
Future<void> getData() async { Future<void> getData() async {
http.Response r = await http.get('/data.json'); http.Response r = await http.get(
'https://flutter.github.io/samples/web/filipino_cuisine/data.json');
fd = json.decode(r.body) as Map<String, dynamic>; fd = json.decode(r.body) as Map<String, dynamic>;
setState(() => fi = fd['0'] as Map<String, dynamic>); setState(() => fi = fd['0'] as Map<String, dynamic>);
} }