Last active
June 10, 2020 17:26
-
-
Save jamescardona11/ca345c190e91340dc5294ea6917871fe to your computer and use it in GitHub Desktop.
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
//########### flpage: ########### | |
//# Create a new page to the application | |
//# add this config: | |
//# CLASS_NAME => fileNameWithoutExtension | |
import 'package:flutter/material.dart'; | |
class $NAME$Page extends StatelessWidget { | |
//static const String pageRoute = '$CLASS_NAME$_route_id'; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: const Text('$NAME$ Page$END$'), | |
), | |
); | |
} | |
} | |
//########### flwidget: ########### | |
//# Create a new widget in other file | |
import 'package:flutter/material.dart'; | |
class $NAME$Widget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container($END$); | |
} | |
} | |
//########### futureBldr: ########### | |
//# Create a CircularProgress when I try to read futureBuilder | |
FutureBuilder( | |
future: $FUTURE$, | |
builder: (BuildContext context, AsyncSnapshot snapshot) { | |
if (!snapshot.hasData || snapshot.data == null) { | |
return Center(child: CircularProgressIndicator()); | |
} else { | |
final data = snapshot.data; | |
return $WIDGET$; | |
} | |
}, | |
), | |
//########### stless: ########### | |
//# Simple statelessWidget | |
class $NAME$ extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Container($END$); | |
} | |
} | |
//########### Snippets to Freezed: ########### | |
//flutter pub run build_runner watch --delete-conflicting-outputs | |
//########### ptf: ########### | |
//# Creates a filled-in freezed part statement | |
//# add this config: | |
//# CLASS_NAME => fileNameWithoutExtension | |
part '$CLASS_NAME$.freezed.dart'; | |
//########### vobj: ########### | |
//# Creates a ValueObject from ValueObject class template | |
import 'package:dartz/dartz.dart'; | |
class $NAME$ extends ValueObject<$TYPE$> { | |
@override | |
final Either<ValueFailure<$TYPE$>, $TYPE$> value; | |
factory $NAME$ ($TYPE$ input) { | |
assert(input != null); | |
return $NAME$._($END$); | |
} | |
const $NAME$._(this.value); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment