graphicbeacon / ferry_graphql_client_demo Goto Github PK
View Code? Open in Web Editor NEWA demo on the Ferry GraphQL for Flutter and Dart
A demo on the Ferry GraphQL for Flutter and Dart
Hello @graphicbeacon , I followed your Graphql / flutter tutorial using my own GraphQL API , the pub run build_runner build command takes forever and it won't stop running until I hit ctr+c , also it generates files that contain errors due to some missing files ,
What seems to be the problem? I would appreciate some help thank you in advance.
// GENERATED CODE - DO NOT MODIFY BY HAND
import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:gql_code_builder/src/serializers/default_scalar_serializer.dart'
as _i1;
part 'schema.schema.gql.g.dart';
abstract class GDate implements Built<GDate, GDateBuilder> {
GDate._();
factory GDate([String value]) =>
_$GDate((b) => value != null ? (b..value = value) : b);
String get value;
@BuiltValueSerializer(custom: true)
static Serializer<GDate> get serializer => _i1.DefaultScalarSerializer<GDate>(
(Object serialized) => GDate(serialized));
}
class GEntriesTimeSheet extends EnumClass {
const GEntriesTimeSheet._(String name) : super(name);
static const GEntriesTimeSheet FULLDAY = _$gEntriesTimeSheetFULLDAY;
static const GEntriesTimeSheet HALFDAY = _$gEntriesTimeSheetHALFDAY;
static const GEntriesTimeSheet HALFDAYHALFHOLIDAY =
_$gEntriesTimeSheetHALFDAYHALFHOLIDAY;
static const GEntriesTimeSheet NOWORK = _$gEntriesTimeSheetNOWORK;
static const GEntriesTimeSheet OFF = _$gEntriesTimeSheetOFF;
static Serializer<GEntriesTimeSheet> get serializer =>
_$gEntriesTimeSheetSerializer;
static BuiltSet<GEntriesTimeSheet> get values => _$gEntriesTimeSheetValues;
static GEntriesTimeSheet valueOf(String name) =>
_$gEntriesTimeSheetValueOf(name);
}
when I first run it it only generates this file which contain tons of errors, this the stack that I get in the terminal when I run the command:
[WARNING] Deleted previous snapshot due to missing asset graph.
[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 10.9s
[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 999ms
[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms
[INFO] Running build...
[WARNING] gql_build:serializer_builder on lib/$lib$:
Your current `analyzer` version may not fully support your current SDK version.
Please try upgrading to the latest `analyzer` by running `flutter packages upgrade`.
Analyzer language version: 2.10.0
SDK language version: 2.13.0
If you are getting this message and have the latest analyzer please file
an issue at https://github.com/dart-lang/sdk/issues/new with the title
"No published analyzer available for language version 2.13.0".
Please search the issue tracker first and thumbs up and/or subscribe to
existing issues if present to avoid duplicates.
I do have an issue which I do not understand:
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text('World Nations'),
),
body: Operation(
client: client,
operationRequest: playStoriesReq,
builder: (
BuildContext context,
OperationResponse<GPlayStoriesData, GPlayStoriesVars> response,
Object error,
) {
if (response.loading) {
return Center(child: CircularProgressIndicator());
}
final stories = response.data!.playStories;
return ListView.builder(
itemCount: stories.length,
itemBuilder: (context, index) => ListTile(
leading: Text(' ' + stories[index].id),
title: Text(stories[index].title),
subtitle: Text(stories[index].statement),
),
);
},
),
),
);
}
I Do always get following issue on the builder:
The argument type 'Widget Function(BuildContext, OperationResponse<GPlayStoriesData, GPlayStoriesVars>, Object)' can't be assigned to the parameter type 'Widget Function(BuildContext, OperationResponse<GPlayStoriesData, GPlayStoriesVars>?, Object?)'.dartargument_type_not_assignable
{required Widget Function(BuildContext, OperationResponse<GPlayStoriesData, GPlayStoriesVars>?, Object?) builder}
My query looks like that:
query PlayStories {
playStories {
title
id
statement
solution
context
newsOrFake
sources {
url
title
sort
publisher
logo
image
id
}
}
}
And in the schema the result is required:
type Query {
playStories: [PlayStory!]!
}
What am I doing wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.