Created
April 9, 2020 18:53
-
-
Save danagbemava/2c5240f677bda729de6c4dbe00ff3a5b to your computer and use it in GitHub Desktop.
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:bloc/bloc.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:flutter_bloc/flutter_bloc.dart'; | |
import 'package:rnm_graphql/blocs/home/home.dart'; | |
import 'package:rnm_graphql/blocs/simple_delegate.dart'; | |
import 'package:rnm_graphql/screens/home_screen.dart'; | |
void main() { | |
BlocSupervisor.delegate = MySimpleBlocDelegate(); | |
runApp(MyApp()); | |
} | |
String query = r''' | |
query { | |
characters(page: 1) { | |
results { | |
id | |
name | |
status | |
} | |
} | |
} | |
'''; | |
class MyApp extends StatelessWidget { | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: BlocProvider<HomeBloc>( | |
create: (BuildContext context) => HomeBloc()..add(FetchHomeData(query)), | |
child: HomeScreen(), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment