Upgrading samples to flutter_lints, part 1 of n (#804)

pull/817/head
Brett Morgan 4 years ago committed by GitHub
parent 14921d0c06
commit 936d1fdaae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.9.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,15 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks file_names: false
- constant_identifier_names package_api_docs: true
- control_flow_in_finally package_prefixed_library_names: true
- directives_ordering test_types_in_equals: true
- empty_statements throw_in_finally: true
- hash_and_equals unnecessary_statements: true
- implementation_imports use_key_in_widget_constructors: false
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -151,7 +151,7 @@ class HomePage extends StatelessWidget {
final headerStyle = Theme.of(context).textTheme.headline6; final headerStyle = Theme.of(context).textTheme.headline6;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Animation Samples'), title: const Text('Animation Samples'),
), ),
body: ListView( body: ListView(
children: [ children: [
@ -168,7 +168,7 @@ class HomePage extends StatelessWidget {
class DemoTile extends StatelessWidget { class DemoTile extends StatelessWidget {
final Demo demo; final Demo demo;
DemoTile(this.demo); const DemoTile(this.demo);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -49,13 +49,13 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
// and shrinking cards. // and shrinking cards.
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('AnimatedContainer'), title: const Text('AnimatedContainer'),
), ),
body: Center( body: Center(
child: Column( child: Column(
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: SizedBox( child: SizedBox(
width: 128, width: 128,
height: 128, height: 128,
@ -70,7 +70,7 @@ class _AnimatedContainerDemoState extends State<AnimatedContainerDemo> {
), ),
), ),
ElevatedButton( ElevatedButton(
child: Text( child: const Text(
'change', 'change',
), ),
onPressed: () => change(), onPressed: () => change(),

@ -11,11 +11,11 @@ class PageRouteBuilderDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Page 1'), title: const Text('Page 1'),
), ),
body: Center( body: Center(
child: ElevatedButton( child: ElevatedButton(
child: Text('Go!'), child: const Text('Go!'),
onPressed: () { onPressed: () {
Navigator.of(context).push<void>(_createRoute()); Navigator.of(context).push<void>(_createRoute());
}, },
@ -29,7 +29,8 @@ Route _createRoute() {
return PageRouteBuilder<SlideTransition>( return PageRouteBuilder<SlideTransition>(
pageBuilder: (context, animation, secondaryAnimation) => _Page2(), pageBuilder: (context, animation, secondaryAnimation) => _Page2(),
transitionsBuilder: (context, animation, secondaryAnimation, child) { transitionsBuilder: (context, animation, secondaryAnimation, child) {
var tween = Tween<Offset>(begin: Offset(0.0, 1.0), end: Offset.zero); var tween =
Tween<Offset>(begin: const Offset(0.0, 1.0), end: Offset.zero);
var curveTween = CurveTween(curve: Curves.ease); var curveTween = CurveTween(curve: Curves.ease);
return SlideTransition( return SlideTransition(
@ -45,7 +46,7 @@ class _Page2 extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Page 2'), title: const Text('Page 2'),
), ),
body: Center( body: Center(
child: Text('Page 2!', style: Theme.of(context).textTheme.headline4), child: Text('Page 2!', style: Theme.of(context).textTheme.headline4),

@ -54,22 +54,22 @@ class _AnimationControllerDemoState extends State<AnimationControllerDemo>
// has completed. // has completed.
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Animation Controller'), title: const Text('Animation Controller'),
), ),
body: Center( body: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints(maxWidth: 200), constraints: const BoxConstraints(maxWidth: 200),
child: Text( child: Text(
'${controller.value.toStringAsFixed(2)}', controller.value.toStringAsFixed(2),
style: Theme.of(context).textTheme.headline3, style: Theme.of(context).textTheme.headline3,
textScaleFactor: 1 + controller.value, textScaleFactor: 1 + controller.value,
), ),
), ),
ElevatedButton( ElevatedButton(
child: Text('animate'), child: const Text('animate'),
onPressed: () { onPressed: () {
if (controller.status == AnimationStatus.completed) { if (controller.status == AnimationStatus.completed) {
controller.reverse(); controller.reverse();

@ -40,16 +40,16 @@ class _TweenDemoState extends State<TweenDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Tweens'), title: const Text('Tweens'),
), ),
body: Center( body: Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints(maxWidth: 200), constraints: const BoxConstraints(maxWidth: 200),
child: Text('\$${animation.value.toStringAsFixed(2)}', child: Text('\$${animation.value.toStringAsFixed(2)}',
style: TextStyle(fontSize: 24)), style: const TextStyle(fontSize: 24)),
), ),
ElevatedButton( ElevatedButton(
child: Text( child: Text(

@ -15,7 +15,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
static const Color beginColor = Colors.deepPurple; static const Color beginColor = Colors.deepPurple;
static const Color endColor = Colors.deepOrange; static const Color endColor = Colors.deepOrange;
Duration duration = Duration(milliseconds: 800); Duration duration = const Duration(milliseconds: 800);
late AnimationController controller; late AnimationController controller;
late Animation<Color?> animation; late Animation<Color?> animation;
@ -38,7 +38,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('AnimatedBuilder'), title: const Text('AnimatedBuilder'),
), ),
body: Center( body: Center(
// AnimatedBuilder handles listening to a given animation and calling the builder // AnimatedBuilder handles listening to a given animation and calling the builder
@ -66,7 +66,7 @@ class _AnimatedBuilderDemoState extends State<AnimatedBuilderDemo>
// if there is a non-animated Widget contained within the animated widget. // if there is a non-animated Widget contained within the animated widget.
// This can improve performance since this widget doesn't need to be rebuilt // This can improve performance since this widget doesn't need to be rebuilt
// when the animation changes. // when the animation changes.
child: Text( child: const Text(
'Change Color', 'Change Color',
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),

@ -47,7 +47,7 @@ class _CustomTweenDemoState extends State<CustomTweenDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Custom Tween'), title: const Text('Custom Tween'),
actions: [ actions: [
MaterialButton( MaterialButton(
child: Text( child: Text(
@ -79,16 +79,18 @@ class _CustomTweenDemoState extends State<CustomTweenDemo>
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Card( child: Card(
child: Container( child: Container(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: AnimatedBuilder( child: AnimatedBuilder(
animation: animation, animation: animation,
builder: (context, child) { builder: (context, child) {
return Text('${animation.value}', return Text(
style: TextStyle( animation.value,
fontSize: 16, fontFamily: 'SpecialElite')); style: const TextStyle(
fontSize: 16, fontFamily: 'SpecialElite'),
);
}, },
), ),
), ),

@ -60,7 +60,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Tween Sequences'), title: const Text('Tween Sequences'),
), ),
body: Center( body: Center(
child: AnimatedBuilder( child: AnimatedBuilder(
@ -75,7 +75,7 @@ class _TweenSequenceDemoState extends State<TweenSequenceDemo>
child: child, child: child,
); );
}, },
child: Text('Animate', style: TextStyle(color: Colors.white)), child: const Text('Animate', style: TextStyle(color: Colors.white)),
), ),
), ),
); );

@ -24,7 +24,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
super.initState(); super.initState();
_controller = AnimationController( _controller = AnimationController(
vsync: this, vsync: this,
duration: Duration(milliseconds: 500), duration: const Duration(milliseconds: 500),
); );
_curve = CurvedAnimation(parent: _controller, curve: Curves.easeIn); _curve = CurvedAnimation(parent: _controller, curve: Curves.easeIn);
@ -45,7 +45,7 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text( title: const Text(
'Fade Transition', 'Fade Transition',
), ),
), ),
@ -55,14 +55,14 @@ class _FadeTransitionDemoState extends State<FadeTransitionDemo>
children: <Widget>[ children: <Widget>[
FadeTransition( FadeTransition(
opacity: _animation, opacity: _animation,
child: Icon( child: const Icon(
Icons.star, Icons.star,
color: Colors.amber, color: Colors.amber,
size: 300, size: 300,
), ),
), ),
ElevatedButton( ElevatedButton(
child: Text('animate'), child: const Text('animate'),
onPressed: () => setState(() { onPressed: () => setState(() {
_controller.animateTo(1.0).then<TickerFuture>( _controller.animateTo(1.0).then<TickerFuture>(
(value) => _controller.animateBack(0.0)); (value) => _controller.animateBack(0.0));

@ -30,7 +30,7 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
UserModel(++_maxIdValue, 'New', 'Person'), UserModel(++_maxIdValue, 'New', 'Person'),
); );
_listKey.currentState! _listKey.currentState!
.insertItem(index, duration: Duration(milliseconds: 300)); .insertItem(index, duration: const Duration(milliseconds: 300));
}); });
} }
@ -42,17 +42,17 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
index, index,
(context, animation) { (context, animation) {
return FadeTransition( return FadeTransition(
opacity: opacity: CurvedAnimation(
CurvedAnimation(parent: animation, curve: Interval(0.5, 1.0)), parent: animation, curve: const Interval(0.5, 1.0)),
child: SizeTransition( child: SizeTransition(
sizeFactor: sizeFactor: CurvedAnimation(
CurvedAnimation(parent: animation, curve: Interval(0.0, 1.0)), parent: animation, curve: const Interval(0.0, 1.0)),
axisAlignment: 0.0, axisAlignment: 0.0,
child: _buildItem(user), child: _buildItem(user),
), ),
); );
}, },
duration: Duration(milliseconds: 600), duration: const Duration(milliseconds: 600),
); );
}); });
} }
@ -62,11 +62,11 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
key: ValueKey<UserModel>(user), key: ValueKey<UserModel>(user),
title: Text(user.firstName), title: Text(user.firstName),
subtitle: Text(user.lastName), subtitle: Text(user.lastName),
leading: CircleAvatar( leading: const CircleAvatar(
child: Icon(Icons.person), child: Icon(Icons.person),
), ),
trailing: IconButton( trailing: IconButton(
icon: Icon(Icons.delete), icon: const Icon(Icons.delete),
onPressed: () => deleteUser(user.id), onPressed: () => deleteUser(user.id),
), ),
); );
@ -76,10 +76,10 @@ class _AnimatedListDemoState extends State<AnimatedListDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('AnimatedList'), title: const Text('AnimatedList'),
actions: <Widget>[ actions: <Widget>[
IconButton( IconButton(
icon: Icon(Icons.add), icon: const Icon(Icons.add),
onPressed: addUser, onPressed: addUser,
), ),
], ],

@ -38,12 +38,12 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
final appBar = AppBar(title: Text('AnimatedPositioned')); final appBar = AppBar(title: const Text('AnimatedPositioned'));
final topPadding = MediaQuery.of(context).padding.top; final topPadding = MediaQuery.of(context).padding.top;
// AnimatedPositioned animates changes to a widget's position within a Stack // AnimatedPositioned animates changes to a widget's position within a Stack
return Scaffold( return Scaffold(
appBar: appBar, appBar: appBar,
body: Container( body: SizedBox(
height: size.height, height: size.height,
width: size.width, width: size.width,
child: Stack( child: Stack(
@ -51,7 +51,7 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
AnimatedPositioned( AnimatedPositioned(
top: topPosition, top: topPosition,
left: leftPosition, left: leftPosition,
duration: Duration(seconds: 1), duration: const Duration(seconds: 1),
child: InkWell( child: InkWell(
onTap: () => changePosition( onTap: () => changePosition(
size.height - size.height -

@ -44,7 +44,7 @@ class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('AnimatedSwitcher'), title: const Text('AnimatedSwitcher'),
actions: [ actions: [
MaterialButton( MaterialButton(
onPressed: () => setState( onPressed: () => setState(
@ -63,7 +63,7 @@ class _AnimatedSwitcherDemoState extends State<AnimatedSwitcherDemo> {
// with a given transition. You can change the transitions by using // with a given transition. You can change the transitions by using
// transitionBuilder property. // transitionBuilder property.
child: AnimatedSwitcher( child: AnimatedSwitcher(
duration: Duration(seconds: 1), duration: const Duration(seconds: 1),
child: container, child: container,
transitionBuilder: (child, animation) => ScaleTransition( transitionBuilder: (child, animation) => ScaleTransition(
child: child, child: child,

@ -35,7 +35,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Card Swipe'), title: const Text('Card Swipe'),
), ),
body: Padding( body: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
@ -78,7 +78,7 @@ class _CardSwipeDemoState extends State<CardSwipeDemo> {
class Card extends StatelessWidget { class Card extends StatelessWidget {
final String imageAssetName; final String imageAssetName;
Card(this.imageAssetName); const Card(this.imageAssetName);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -101,7 +101,7 @@ class SwipeableCard extends StatefulWidget {
final String imageAssetName; final String imageAssetName;
final VoidCallback onSwiped; final VoidCallback onSwiped;
SwipeableCard({ const SwipeableCard({
required this.onSwiped, required this.onSwiped,
required this.imageAssetName, required this.imageAssetName,
}); });
@ -123,7 +123,7 @@ class _SwipeableCardState extends State<SwipeableCard>
_controller = AnimationController.unbounded(vsync: this); _controller = AnimationController.unbounded(vsync: this);
_animation = _controller.drive(Tween<Offset>( _animation = _controller.drive(Tween<Offset>(
begin: Offset.zero, begin: Offset.zero,
end: Offset(1, 0), end: const Offset(1, 0),
)); ));
} }
@ -184,12 +184,13 @@ class _SwipeableCardState extends State<SwipeableCard>
void _updateAnimation(double dragPosition) { void _updateAnimation(double dragPosition) {
_animation = _controller.drive(Tween<Offset>( _animation = _controller.drive(Tween<Offset>(
begin: Offset.zero, begin: Offset.zero,
end: _isSwipingLeft ? Offset(-1, 0) : Offset(1, 0), end: _isSwipingLeft ? const Offset(-1, 0) : const Offset(1, 0),
)); ));
} }
void _animate({double velocity = 0}) { void _animate({double velocity = 0}) {
var description = SpringDescription(mass: 50, stiffness: 1, damping: 1); var description =
const SpringDescription(mass: 50, stiffness: 1, damping: 1);
var simulation = var simulation =
SpringSimulation(description, _controller.value, 1, velocity); SpringSimulation(description, _controller.value, 1, velocity);
_controller.animateWith(simulation).then<void>((_) { _controller.animateWith(simulation).then<void>((_) {

@ -22,7 +22,7 @@ class CarouselDemo extends StatelessWidget {
Widget build(context) { Widget build(context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Carousel Demo'), title: const Text('Carousel Demo'),
), ),
body: Center( body: Center(
child: Padding( child: Padding(

@ -25,7 +25,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
late final Animation<double> animationRotation; late final Animation<double> animationRotation;
late final Animation<Offset> animationTranslation; late final Animation<Offset> animationTranslation;
static const _duration = Duration(seconds: 4); static const _duration = Duration(seconds: 4);
List<CurveChoice> curves = [ List<CurveChoice> curves = const [
CurveChoice(curve: Curves.bounceIn, name: 'Bounce In'), CurveChoice(curve: Curves.bounceIn, name: 'Bounce In'),
CurveChoice(curve: Curves.bounceOut, name: 'Bounce Out'), CurveChoice(curve: Curves.bounceOut, name: 'Bounce Out'),
CurveChoice(curve: Curves.easeInCubic, name: 'Ease In Cubic'), CurveChoice(curve: Curves.easeInCubic, name: 'Ease In Cubic'),
@ -69,8 +69,8 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
} }
}); });
animationTranslation = Tween<Offset>( animationTranslation = Tween<Offset>(
begin: Offset(-1, 0), begin: const Offset(-1, 0),
end: Offset(1, 0), end: const Offset(1, 0),
).animate(curvedAnimation) ).animate(curvedAnimation)
..addListener(() { ..addListener(() {
setState(() {}); setState(() {});
@ -86,11 +86,11 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Curved Animation'), title: const Text('Curved Animation'),
), ),
body: Column( body: Column(
children: [ children: [
SizedBox(height: 20.0), const SizedBox(height: 20.0),
Text( Text(
'Select Curve for forward motion', 'Select Curve for forward motion',
style: Theme.of(context).textTheme.headline6, style: Theme.of(context).textTheme.headline6,
@ -110,7 +110,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
}, },
value: selectedForwardCurve, value: selectedForwardCurve,
), ),
SizedBox(height: 15.0), const SizedBox(height: 15.0),
Text( Text(
'Select Curve for reverse motion', 'Select Curve for reverse motion',
style: Theme.of(context).textTheme.headline6, style: Theme.of(context).textTheme.headline6,
@ -130,32 +130,28 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
}, },
value: selectedReverseCurve, value: selectedReverseCurve,
), ),
SizedBox(height: 35.0), const SizedBox(height: 35.0),
Transform.rotate( Transform.rotate(
angle: animationRotation.value, angle: animationRotation.value,
child: Center( child: const Center(
child: Container( child: FlutterLogo(
child: FlutterLogo( size: 100,
size: 100,
),
), ),
), ),
), ),
SizedBox(height: 35.0), const SizedBox(height: 35.0),
FractionalTranslation( FractionalTranslation(
translation: animationTranslation.value, translation: animationTranslation.value,
child: Container( child: const FlutterLogo(
child: FlutterLogo( size: 100,
size: 100,
),
), ),
), ),
SizedBox(height: 25.0), const SizedBox(height: 25.0),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
controller.forward(); controller.forward();
}, },
child: Text('Animate'), child: const Text('Animate'),
), ),
], ],
), ),

@ -11,7 +11,7 @@ class ExpandCardDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Expandable Card'), title: const Text('Expandable Card'),
), ),
body: Center( body: Center(
child: ExpandCard(), child: ExpandCard(),

@ -10,7 +10,7 @@ class FocusImageDemo extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text('Focus Image')), appBar: AppBar(title: const Text('Focus Image')),
body: Grid(), body: Grid(),
); );
} }
@ -23,11 +23,11 @@ class Grid extends StatelessWidget {
body: GridView.builder( body: GridView.builder(
itemCount: 40, itemCount: 40,
gridDelegate: gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4), const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 4),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return (index >= 20) return (index >= 20)
? SmallCard('assets/eat_cape_town_sm.jpg') ? const SmallCard('assets/eat_cape_town_sm.jpg')
: SmallCard('assets/eat_new_orleans_sm.jpg'); : const SmallCard('assets/eat_new_orleans_sm.jpg');
}, },
), ),
); );
@ -68,7 +68,7 @@ Tween<RelativeRect> _createTween(BuildContext context) {
class SmallCard extends StatelessWidget { class SmallCard extends StatelessWidget {
final String imageAssetName; final String imageAssetName;
SmallCard(this.imageAssetName); const SmallCard(this.imageAssetName);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -92,7 +92,7 @@ class SmallCard extends StatelessWidget {
class _SecondPage extends StatelessWidget { class _SecondPage extends StatelessWidget {
final String imageAssetName; final String imageAssetName;
_SecondPage(this.imageAssetName); const _SecondPage(this.imageAssetName);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -11,7 +11,7 @@ class HeroAnimationDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Hero Animation'), title: const Text('Hero Animation'),
), ),
body: GestureDetector( body: GestureDetector(
child: Hero( child: Hero(
@ -54,12 +54,12 @@ StatelessWidget _createHeroContainer({
return Container( return Container(
height: size, height: size,
width: size, width: size,
padding: EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
margin: size < 100.0 ? EdgeInsets.all(10.0) : EdgeInsets.all(0), margin: size < 100.0 ? const EdgeInsets.all(10.0) : const EdgeInsets.all(0),
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: color, color: color,
), ),
child: FlutterLogo(), child: const FlutterLogo(),
); );
} }

@ -12,9 +12,9 @@ class PhysicsCardDragDemo extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Spring Physics'), title: const Text('Spring Physics'),
), ),
body: DraggableCard( body: const DraggableCard(
child: FlutterLogo( child: FlutterLogo(
size: 128, size: 128,
), ),
@ -27,7 +27,7 @@ class PhysicsCardDragDemo extends StatelessWidget {
/// released. /// released.
class DraggableCard extends StatefulWidget { class DraggableCard extends StatefulWidget {
final Widget child; final Widget child;
DraggableCard({required this.child}); const DraggableCard({required this.child});
@override @override
_DraggableCardState createState() => _DraggableCardState(); _DraggableCardState createState() => _DraggableCardState();

@ -33,7 +33,7 @@ class RepeatingAnimationDemoState extends State<RepeatingAnimationDemo>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar(title: Text('Repeating Animation')), appBar: AppBar(title: const Text('Repeating Animation')),
body: Center( body: Center(
child: AnimatedBuilder( child: AnimatedBuilder(
animation: _borderRadius, animation: _borderRadius,

@ -26,10 +26,6 @@
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; };
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; };
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */ /* Begin PBXContainerItemProxy section */
@ -49,8 +45,6 @@
dstPath = ""; dstPath = "";
dstSubfolderSpec = 10; dstSubfolderSpec = 10;
files = ( files = (
D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */,
33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */,
); );
name = "Bundle Framework"; name = "Bundle Framework";
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@ -69,13 +63,11 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; }; 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = "<group>"; };
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; }; 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = "<group>"; };
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; }; 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = "<group>"; };
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FlutterMacOS.framework; path = Flutter/ephemeral/FlutterMacOS.framework; sourceTree = SOURCE_ROOT; };
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; }; 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
@ -83,8 +75,6 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
D73912F022F37F9E000D13A0 /* App.framework in Frameworks */,
33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -138,8 +128,6 @@
33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */,
33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */,
33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */,
D73912EF22F37F9E000D13A0 /* App.framework */,
33D1A10322148B71006C7A3E /* FlutterMacOS.framework */,
); );
path = Flutter; path = Flutter;
sourceTree = "<group>"; sourceTree = "<group>";
@ -260,7 +248,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename\n"; shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
}; };
33CC111E2044C6BF0003C045 /* ShellScript */ = { 33CC111E2044C6BF0003C045 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;

@ -49,7 +49,7 @@ packages:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.3"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -62,11 +62,25 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -88,13 +102,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter

@ -3,7 +3,7 @@ description: A new Flutter project.
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.12.0-0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
@ -13,7 +13,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.9.0 flutter_lints: ^1.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true

@ -20,7 +20,8 @@ void main() {
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length; var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
// Swipe out one card. // Swipe out one card.
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0)); await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Check if removed properly. // Check if removed properly.
@ -37,7 +38,8 @@ void main() {
// Swipe out all cards. // Swipe out all cards.
for (var i = 0; i < totalCards; i++) { for (var i = 0; i < totalCards; i++) {
// Swipe out one by one. // Swipe out one by one.
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0)); await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
} }
@ -52,7 +54,8 @@ void main() {
var totalCards = tester.widgetList(find.byType(SwipeableCard)).length; var totalCards = tester.widgetList(find.byType(SwipeableCard)).length;
// Swipe out one card. // Swipe out one card.
await tester.drag(find.byType(SwipeableCard).first, Offset(100.0, 0.0)); await tester.drag(
find.byType(SwipeableCard).first, const Offset(100.0, 0.0));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Tap the Refill button. // Tap the Refill button.

@ -20,7 +20,7 @@ void main() {
expect(imageList.length, 2); expect(imageList.length, 2);
// Swipe the Carousel. // Swipe the Carousel.
await tester.fling(find.byType(CarouselDemo), Offset(-400, 0), 800); await tester.fling(find.byType(CarouselDemo), const Offset(-400, 0), 800);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
// Get the images available on the screen after swipe. // Get the images available on the screen after swipe.

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.9.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,14 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks package_api_docs: true
- constant_identifier_names package_prefixed_library_names: true
- control_flow_in_finally test_types_in_equals: true
- directives_ordering throw_in_finally: true
- empty_statements unnecessary_statements: true
- hash_and_equals use_key_in_widget_constructors: false
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -5,12 +5,10 @@
import 'dart:io'; import 'dart:io';
import 'package:file_selector/file_selector.dart'; import 'package:file_selector/file_selector.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_simple_treeview/flutter_simple_treeview.dart'; import 'package:flutter_simple_treeview/flutter_simple_treeview.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:menubar/menubar.dart' as menubar; import 'package:menubar/menubar.dart' as menubar;
import 'package:meta/meta.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'src/model/photo_search_model.dart'; import 'src/model/photo_search_model.dart';
@ -58,7 +56,7 @@ class UnsplashSearchApp extends StatelessWidget {
} }
class UnsplashHomePage extends StatelessWidget { class UnsplashHomePage extends StatelessWidget {
const UnsplashHomePage({@required this.title}); const UnsplashHomePage({required this.title});
final String title; final String title;
@override @override
@ -83,7 +81,7 @@ class UnsplashHomePage extends StatelessWidget {
onClicked: () { onClicked: () {
showDialog<void>( showDialog<void>(
context: context, context: context,
builder: (context) => PolicyDialog(), builder: (context) => const PolicyDialog(),
); );
}, },
), ),
@ -111,7 +109,7 @@ class UnsplashHomePage extends StatelessWidget {
secondChild: Center( secondChild: Center(
child: photoSearchModel.selectedPhoto != null child: photoSearchModel.selectedPhoto != null
? PhotoDetails( ? PhotoDetails(
photo: photoSearchModel.selectedPhoto, photo: photoSearchModel.selectedPhoto!,
onPhotoSave: (photo) async { onPhotoSave: (photo) async {
final path = await getSavePath( final path = await getSavePath(
suggestedName: '${photo.id}.jpg', suggestedName: '${photo.id}.jpg',
@ -144,7 +142,7 @@ class UnsplashHomePage extends StatelessWidget {
builder: (context) => PhotoSearchDialog(photoSearchModel.addSearch), builder: (context) => PhotoSearchDialog(photoSearchModel.addSearch),
), ),
tooltip: 'Search for a photo', tooltip: 'Search for a photo',
child: Icon(Icons.search), child: const Icon(Icons.search),
), ),
); );
} }
@ -165,7 +163,7 @@ class UnsplashHomePage extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Text( child: Text(
'Photo by ${photo.user.name}', 'Photo by ${photo.user!.name}',
), ),
), ),
), ),

@ -5,7 +5,6 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:meta/meta.dart';
import '../unsplash/photo.dart'; import '../unsplash/photo.dart';
import '../unsplash/unsplash.dart'; import '../unsplash/unsplash.dart';
@ -25,13 +24,13 @@ class PhotoSearchModel extends ChangeNotifier {
List<SearchEntry> get entries => List.unmodifiable(_entries); List<SearchEntry> get entries => List.unmodifiable(_entries);
final List<SearchEntry> _entries = []; final List<SearchEntry> _entries = [];
Photo get selectedPhoto => _selectedPhoto; Photo? get selectedPhoto => _selectedPhoto;
set selectedPhoto(Photo photo) { set selectedPhoto(Photo? photo) {
_selectedPhoto = photo; _selectedPhoto = photo;
notifyListeners(); notifyListeners();
} }
Photo _selectedPhoto; Photo? _selectedPhoto;
Future<void> addSearch(String query) async { Future<void> addSearch(String query) async {
final result = await _client.searchPhotos( final result = await _client.searchPhotos(
@ -41,13 +40,12 @@ class PhotoSearchModel extends ChangeNotifier {
final search = Search((s) { final search = Search((s) {
s s
..query = query ..query = query
..results.addAll(result.results); ..results.addAll(result!.results);
}); });
_entries.add(SearchEntry(query, search.results.toList(), this)); _entries.add(SearchEntry(query, search.results.toList(), this));
notifyListeners(); notifyListeners();
} }
Future<Uint8List> download({@required Photo photo}) => Future<Uint8List> download({required Photo photo}) => _client.download(photo);
_client.download(photo);
} }

@ -14,7 +14,7 @@ import '../unsplash/photo.dart';
part 'search.g.dart'; part 'search.g.dart';
abstract class Search implements Built<Search, SearchBuilder> { abstract class Search implements Built<Search, SearchBuilder> {
factory Search([void Function(SearchBuilder) updates]) = _$Search; factory Search([void Function(SearchBuilder)? updates]) = _$Search;
Search._(); Search._();
@BuiltValueField(wireName: 'query') @BuiltValueField(wireName: 'query')
@ -27,7 +27,7 @@ abstract class Search implements Built<Search, SearchBuilder> {
return json.encode(serializers.serializeWith(Search.serializer, this)); return json.encode(serializers.serializeWith(Search.serializer, this));
} }
static Search fromJson(String jsonString) { static Search? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Search.serializer, json.decode(jsonString)); Search.serializer, json.decode(jsonString));
} }

@ -19,9 +19,9 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
final String wireName = 'Search'; final String wireName = 'Search';
@override @override
Iterable<Object> serialize(Serializers serializers, Search object, Iterable<Object?> serialize(Serializers serializers, Search object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'query', 'query',
serializers.serialize(object.query, serializers.serialize(object.query,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
@ -35,7 +35,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
} }
@override @override
Search deserialize(Serializers serializers, Iterable<Object> serialized, Search deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new SearchBuilder(); final result = new SearchBuilder();
@ -43,7 +43,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'query': case 'query':
result.query = serializers.deserialize(value, result.query = serializers.deserialize(value,
@ -52,7 +52,7 @@ class _$SearchSerializer implements StructuredSerializer<Search> {
case 'results': case 'results':
result.results.replace(serializers.deserialize(value, result.results.replace(serializers.deserialize(value,
specifiedType: specifiedType:
const FullType(BuiltList, const [const FullType(Photo)])) const FullType(BuiltList, const [const FullType(Photo)]))!
as BuiltList<Object>); as BuiltList<Object>);
break; break;
} }
@ -68,10 +68,10 @@ class _$Search extends Search {
@override @override
final BuiltList<Photo> results; final BuiltList<Photo> results;
factory _$Search([void Function(SearchBuilder) updates]) => factory _$Search([void Function(SearchBuilder)? updates]) =>
(new SearchBuilder()..update(updates)).build(); (new SearchBuilder()..update(updates)).build();
_$Search._({this.query, this.results}) : super._() { _$Search._({required this.query, required this.results}) : super._() {
BuiltValueNullFieldError.checkNotNull(query, 'Search', 'query'); BuiltValueNullFieldError.checkNotNull(query, 'Search', 'query');
BuiltValueNullFieldError.checkNotNull(results, 'Search', 'results'); BuiltValueNullFieldError.checkNotNull(results, 'Search', 'results');
} }
@ -104,16 +104,16 @@ class _$Search extends Search {
} }
class SearchBuilder implements Builder<Search, SearchBuilder> { class SearchBuilder implements Builder<Search, SearchBuilder> {
_$Search _$v; _$Search? _$v;
String _query; String? _query;
String get query => _$this._query; String? get query => _$this._query;
set query(String query) => _$this._query = query; set query(String? query) => _$this._query = query;
ListBuilder<Photo> _results; ListBuilder<Photo>? _results;
ListBuilder<Photo> get results => ListBuilder<Photo> get results =>
_$this._results ??= new ListBuilder<Photo>(); _$this._results ??= new ListBuilder<Photo>();
set results(ListBuilder<Photo> results) => _$this._results = results; set results(ListBuilder<Photo>? results) => _$this._results = results;
SearchBuilder(); SearchBuilder();
@ -134,7 +134,7 @@ class SearchBuilder implements Builder<Search, SearchBuilder> {
} }
@override @override
void update(void Function(SearchBuilder) updates) { void update(void Function(SearchBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -148,7 +148,7 @@ class SearchBuilder implements Builder<Search, SearchBuilder> {
query, 'Search', 'query'), query, 'Search', 'query'),
results: results.build()); results: results.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'results'; _$failedField = 'results';
results.build(); results.build();

@ -13,18 +13,18 @@ import '../serializers.dart';
part 'api_error.g.dart'; part 'api_error.g.dart';
abstract class ApiError implements Built<ApiError, ApiErrorBuilder> { abstract class ApiError implements Built<ApiError, ApiErrorBuilder> {
factory ApiError([void Function(ApiErrorBuilder) updates]) = _$ApiError; factory ApiError([void Function(ApiErrorBuilder)? updates]) = _$ApiError;
ApiError._(); ApiError._();
@BuiltValueField(wireName: 'errors') @BuiltValueField(wireName: 'errors')
BuiltList<String> get errors; BuiltList<String>? get errors;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(ApiError.serializer, this)); return json.encode(serializers.serializeWith(ApiError.serializer, this));
} }
static ApiError fromJson(String jsonString) { static ApiError? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
ApiError.serializer, json.decode(jsonString)); ApiError.serializer, json.decode(jsonString));
} }

@ -19,20 +19,23 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
final String wireName = 'ApiError'; final String wireName = 'ApiError';
@override @override
Iterable<Object> serialize(Serializers serializers, ApiError object, Iterable<Object?> serialize(Serializers serializers, ApiError object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[];
'errors', Object? value;
serializers.serialize(object.errors, value = object.errors;
specifiedType: if (value != null) {
const FullType(BuiltList, const [const FullType(String)])), result
]; ..add('errors')
..add(serializers.serialize(value,
specifiedType:
const FullType(BuiltList, const [const FullType(String)])));
}
return result; return result;
} }
@override @override
ApiError deserialize(Serializers serializers, Iterable<Object> serialized, ApiError deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new ApiErrorBuilder(); final result = new ApiErrorBuilder();
@ -40,12 +43,12 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'errors': case 'errors':
result.errors.replace(serializers.deserialize(value, result.errors.replace(serializers.deserialize(value,
specifiedType: specifiedType: const FullType(
const FullType(BuiltList, const [const FullType(String)])) BuiltList, const [const FullType(String)]))!
as BuiltList<Object>); as BuiltList<Object>);
break; break;
} }
@ -57,14 +60,12 @@ class _$ApiErrorSerializer implements StructuredSerializer<ApiError> {
class _$ApiError extends ApiError { class _$ApiError extends ApiError {
@override @override
final BuiltList<String> errors; final BuiltList<String>? errors;
factory _$ApiError([void Function(ApiErrorBuilder) updates]) => factory _$ApiError([void Function(ApiErrorBuilder)? updates]) =>
(new ApiErrorBuilder()..update(updates)).build(); (new ApiErrorBuilder()..update(updates)).build();
_$ApiError._({this.errors}) : super._() { _$ApiError._({this.errors}) : super._();
BuiltValueNullFieldError.checkNotNull(errors, 'ApiError', 'errors');
}
@override @override
ApiError rebuild(void Function(ApiErrorBuilder) updates) => ApiError rebuild(void Function(ApiErrorBuilder) updates) =>
@ -92,19 +93,19 @@ class _$ApiError extends ApiError {
} }
class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> { class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
_$ApiError _$v; _$ApiError? _$v;
ListBuilder<String> _errors; ListBuilder<String>? _errors;
ListBuilder<String> get errors => ListBuilder<String> get errors =>
_$this._errors ??= new ListBuilder<String>(); _$this._errors ??= new ListBuilder<String>();
set errors(ListBuilder<String> errors) => _$this._errors = errors; set errors(ListBuilder<String>? errors) => _$this._errors = errors;
ApiErrorBuilder(); ApiErrorBuilder();
ApiErrorBuilder get _$this { ApiErrorBuilder get _$this {
final $v = _$v; final $v = _$v;
if ($v != null) { if ($v != null) {
_errors = $v.errors.toBuilder(); _errors = $v.errors?.toBuilder();
_$v = null; _$v = null;
} }
return this; return this;
@ -117,7 +118,7 @@ class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
} }
@override @override
void update(void Function(ApiErrorBuilder) updates) { void update(void Function(ApiErrorBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -125,12 +126,12 @@ class ApiErrorBuilder implements Builder<ApiError, ApiErrorBuilder> {
_$ApiError build() { _$ApiError build() {
_$ApiError _$result; _$ApiError _$result;
try { try {
_$result = _$v ?? new _$ApiError._(errors: errors.build()); _$result = _$v ?? new _$ApiError._(errors: _errors?.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'errors'; _$failedField = 'errors';
errors.build(); _errors?.build();
} catch (e) { } catch (e) {
throw new BuiltValueNestedFieldError( throw new BuiltValueNestedFieldError(
'ApiError', _$failedField, e.toString()); 'ApiError', _$failedField, e.toString());

@ -14,7 +14,7 @@ part 'current_user_collections.g.dart';
abstract class CurrentUserCollections abstract class CurrentUserCollections
implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements Built<CurrentUserCollections, CurrentUserCollectionsBuilder> {
factory CurrentUserCollections( factory CurrentUserCollections(
[void Function(CurrentUserCollectionsBuilder) updates]) = [void Function(CurrentUserCollectionsBuilder)? updates]) =
_$CurrentUserCollections; _$CurrentUserCollections;
CurrentUserCollections._(); CurrentUserCollections._();
@ -22,24 +22,21 @@ abstract class CurrentUserCollections
@BuiltValueField(wireName: 'id') @BuiltValueField(wireName: 'id')
int get id; int get id;
@nullable
@BuiltValueField(wireName: 'title') @BuiltValueField(wireName: 'title')
String get title; String? get title;
@nullable
@BuiltValueField(wireName: 'published_at') @BuiltValueField(wireName: 'published_at')
String get publishedAt; String? get publishedAt;
@nullable
@BuiltValueField(wireName: 'updated_at') @BuiltValueField(wireName: 'updated_at')
String get updatedAt; String? get updatedAt;
String toJson() { String toJson() {
return json.encode( return json.encode(
serializers.serializeWith(CurrentUserCollections.serializer, this)); serializers.serializeWith(CurrentUserCollections.serializer, this));
} }
static CurrentUserCollections fromJson(String jsonString) { static CurrentUserCollections? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
CurrentUserCollections.serializer, json.decode(jsonString)); CurrentUserCollections.serializer, json.decode(jsonString));
} }

@ -24,14 +24,14 @@ class _$CurrentUserCollectionsSerializer
final String wireName = 'CurrentUserCollections'; final String wireName = 'CurrentUserCollections';
@override @override
Iterable<Object> serialize( Iterable<Object?> serialize(
Serializers serializers, CurrentUserCollections object, Serializers serializers, CurrentUserCollections object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(int)), serializers.serialize(object.id, specifiedType: const FullType(int)),
]; ];
Object value; Object? value;
value = object.title; value = object.title;
if (value != null) { if (value != null) {
result result
@ -58,7 +58,7 @@ class _$CurrentUserCollectionsSerializer
@override @override
CurrentUserCollections deserialize( CurrentUserCollections deserialize(
Serializers serializers, Iterable<Object> serialized, Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new CurrentUserCollectionsBuilder(); final result = new CurrentUserCollectionsBuilder();
@ -66,7 +66,7 @@ class _$CurrentUserCollectionsSerializer
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'id': case 'id':
result.id = serializers.deserialize(value, result.id = serializers.deserialize(value,
@ -95,18 +95,18 @@ class _$CurrentUserCollections extends CurrentUserCollections {
@override @override
final int id; final int id;
@override @override
final String title; final String? title;
@override @override
final String publishedAt; final String? publishedAt;
@override @override
final String updatedAt; final String? updatedAt;
factory _$CurrentUserCollections( factory _$CurrentUserCollections(
[void Function(CurrentUserCollectionsBuilder) updates]) => [void Function(CurrentUserCollectionsBuilder)? updates]) =>
(new CurrentUserCollectionsBuilder()..update(updates)).build(); (new CurrentUserCollectionsBuilder()..update(updates)).build();
_$CurrentUserCollections._( _$CurrentUserCollections._(
{this.id, this.title, this.publishedAt, this.updatedAt}) {required this.id, this.title, this.publishedAt, this.updatedAt})
: super._() { : super._() {
BuiltValueNullFieldError.checkNotNull(id, 'CurrentUserCollections', 'id'); BuiltValueNullFieldError.checkNotNull(id, 'CurrentUserCollections', 'id');
} }
@ -150,23 +150,23 @@ class _$CurrentUserCollections extends CurrentUserCollections {
class CurrentUserCollectionsBuilder class CurrentUserCollectionsBuilder
implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> { implements Builder<CurrentUserCollections, CurrentUserCollectionsBuilder> {
_$CurrentUserCollections _$v; _$CurrentUserCollections? _$v;
int _id; int? _id;
int get id => _$this._id; int? get id => _$this._id;
set id(int id) => _$this._id = id; set id(int? id) => _$this._id = id;
String _title; String? _title;
String get title => _$this._title; String? get title => _$this._title;
set title(String title) => _$this._title = title; set title(String? title) => _$this._title = title;
String _publishedAt; String? _publishedAt;
String get publishedAt => _$this._publishedAt; String? get publishedAt => _$this._publishedAt;
set publishedAt(String publishedAt) => _$this._publishedAt = publishedAt; set publishedAt(String? publishedAt) => _$this._publishedAt = publishedAt;
String _updatedAt; String? _updatedAt;
String get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt; set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
CurrentUserCollectionsBuilder(); CurrentUserCollectionsBuilder();
@ -189,7 +189,7 @@ class CurrentUserCollectionsBuilder
} }
@override @override
void update(void Function(CurrentUserCollectionsBuilder) updates) { void update(void Function(CurrentUserCollectionsBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -12,39 +12,33 @@ import '../serializers.dart';
part 'exif.g.dart'; part 'exif.g.dart';
abstract class Exif implements Built<Exif, ExifBuilder> { abstract class Exif implements Built<Exif, ExifBuilder> {
factory Exif([void Function(ExifBuilder) updates]) = _$Exif; factory Exif([void Function(ExifBuilder)? updates]) = _$Exif;
Exif._(); Exif._();
@nullable
@BuiltValueField(wireName: 'make') @BuiltValueField(wireName: 'make')
String get make; String? get make;
@nullable
@BuiltValueField(wireName: 'model') @BuiltValueField(wireName: 'model')
String get model; String? get model;
@nullable
@BuiltValueField(wireName: 'exposure_time') @BuiltValueField(wireName: 'exposure_time')
String get exposureTime; String? get exposureTime;
@nullable
@BuiltValueField(wireName: 'aperture') @BuiltValueField(wireName: 'aperture')
String get aperture; String? get aperture;
@nullable
@BuiltValueField(wireName: 'focal_length') @BuiltValueField(wireName: 'focal_length')
String get focalLength; String? get focalLength;
@nullable
@BuiltValueField(wireName: 'iso') @BuiltValueField(wireName: 'iso')
int get iso; int? get iso;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Exif.serializer, this)); return json.encode(serializers.serializeWith(Exif.serializer, this));
} }
static Exif fromJson(String jsonString) { static Exif? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Exif.serializer, json.decode(jsonString)); Exif.serializer, json.decode(jsonString));
} }

@ -19,10 +19,10 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
final String wireName = 'Exif'; final String wireName = 'Exif';
@override @override
Iterable<Object> serialize(Serializers serializers, Exif object, Iterable<Object?> serialize(Serializers serializers, Exif object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[]; final result = <Object?>[];
Object value; Object? value;
value = object.make; value = object.make;
if (value != null) { if (value != null) {
result result
@ -68,7 +68,7 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
} }
@override @override
Exif deserialize(Serializers serializers, Iterable<Object> serialized, Exif deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new ExifBuilder(); final result = new ExifBuilder();
@ -76,7 +76,7 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'make': case 'make':
result.make = serializers.deserialize(value, result.make = serializers.deserialize(value,
@ -111,19 +111,19 @@ class _$ExifSerializer implements StructuredSerializer<Exif> {
class _$Exif extends Exif { class _$Exif extends Exif {
@override @override
final String make; final String? make;
@override @override
final String model; final String? model;
@override @override
final String exposureTime; final String? exposureTime;
@override @override
final String aperture; final String? aperture;
@override @override
final String focalLength; final String? focalLength;
@override @override
final int iso; final int? iso;
factory _$Exif([void Function(ExifBuilder) updates]) => factory _$Exif([void Function(ExifBuilder)? updates]) =>
(new ExifBuilder()..update(updates)).build(); (new ExifBuilder()..update(updates)).build();
_$Exif._( _$Exif._(
@ -180,31 +180,31 @@ class _$Exif extends Exif {
} }
class ExifBuilder implements Builder<Exif, ExifBuilder> { class ExifBuilder implements Builder<Exif, ExifBuilder> {
_$Exif _$v; _$Exif? _$v;
String _make; String? _make;
String get make => _$this._make; String? get make => _$this._make;
set make(String make) => _$this._make = make; set make(String? make) => _$this._make = make;
String _model; String? _model;
String get model => _$this._model; String? get model => _$this._model;
set model(String model) => _$this._model = model; set model(String? model) => _$this._model = model;
String _exposureTime; String? _exposureTime;
String get exposureTime => _$this._exposureTime; String? get exposureTime => _$this._exposureTime;
set exposureTime(String exposureTime) => _$this._exposureTime = exposureTime; set exposureTime(String? exposureTime) => _$this._exposureTime = exposureTime;
String _aperture; String? _aperture;
String get aperture => _$this._aperture; String? get aperture => _$this._aperture;
set aperture(String aperture) => _$this._aperture = aperture; set aperture(String? aperture) => _$this._aperture = aperture;
String _focalLength; String? _focalLength;
String get focalLength => _$this._focalLength; String? get focalLength => _$this._focalLength;
set focalLength(String focalLength) => _$this._focalLength = focalLength; set focalLength(String? focalLength) => _$this._focalLength = focalLength;
int _iso; int? _iso;
int get iso => _$this._iso; int? get iso => _$this._iso;
set iso(int iso) => _$this._iso = iso; set iso(int? iso) => _$this._iso = iso;
ExifBuilder(); ExifBuilder();
@ -229,7 +229,7 @@ class ExifBuilder implements Builder<Exif, ExifBuilder> {
} }
@override @override
void update(void Function(ExifBuilder) updates) { void update(void Function(ExifBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -12,31 +12,27 @@ import '../serializers.dart';
part 'links.g.dart'; part 'links.g.dart';
abstract class Links implements Built<Links, LinksBuilder> { abstract class Links implements Built<Links, LinksBuilder> {
factory Links([void Function(LinksBuilder) updates]) = _$Links; factory Links([void Function(LinksBuilder)? updates]) = _$Links;
Links._(); Links._();
@nullable
@BuiltValueField(wireName: 'self') @BuiltValueField(wireName: 'self')
String get self; String? get self;
@nullable
@BuiltValueField(wireName: 'html') @BuiltValueField(wireName: 'html')
String get html; String? get html;
@nullable
@BuiltValueField(wireName: 'download') @BuiltValueField(wireName: 'download')
String get download; String? get download;
@nullable
@BuiltValueField(wireName: 'download_location') @BuiltValueField(wireName: 'download_location')
String get downloadLocation; String? get downloadLocation;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Links.serializer, this)); return json.encode(serializers.serializeWith(Links.serializer, this));
} }
static Links fromJson(String jsonString) { static Links? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Links.serializer, json.decode(jsonString)); Links.serializer, json.decode(jsonString));
} }

@ -19,10 +19,10 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
final String wireName = 'Links'; final String wireName = 'Links';
@override @override
Iterable<Object> serialize(Serializers serializers, Links object, Iterable<Object?> serialize(Serializers serializers, Links object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[]; final result = <Object?>[];
Object value; Object? value;
value = object.self; value = object.self;
if (value != null) { if (value != null) {
result result
@ -55,7 +55,7 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
} }
@override @override
Links deserialize(Serializers serializers, Iterable<Object> serialized, Links deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new LinksBuilder(); final result = new LinksBuilder();
@ -63,7 +63,7 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'self': case 'self':
result.self = serializers.deserialize(value, result.self = serializers.deserialize(value,
@ -90,15 +90,15 @@ class _$LinksSerializer implements StructuredSerializer<Links> {
class _$Links extends Links { class _$Links extends Links {
@override @override
final String self; final String? self;
@override @override
final String html; final String? html;
@override @override
final String download; final String? download;
@override @override
final String downloadLocation; final String? downloadLocation;
factory _$Links([void Function(LinksBuilder) updates]) => factory _$Links([void Function(LinksBuilder)? updates]) =>
(new LinksBuilder()..update(updates)).build(); (new LinksBuilder()..update(updates)).build();
_$Links._({this.self, this.html, this.download, this.downloadLocation}) _$Links._({this.self, this.html, this.download, this.downloadLocation})
@ -140,23 +140,23 @@ class _$Links extends Links {
} }
class LinksBuilder implements Builder<Links, LinksBuilder> { class LinksBuilder implements Builder<Links, LinksBuilder> {
_$Links _$v; _$Links? _$v;
String _self; String? _self;
String get self => _$this._self; String? get self => _$this._self;
set self(String self) => _$this._self = self; set self(String? self) => _$this._self = self;
String _html; String? _html;
String get html => _$this._html; String? get html => _$this._html;
set html(String html) => _$this._html = html; set html(String? html) => _$this._html = html;
String _download; String? _download;
String get download => _$this._download; String? get download => _$this._download;
set download(String download) => _$this._download = download; set download(String? download) => _$this._download = download;
String _downloadLocation; String? _downloadLocation;
String get downloadLocation => _$this._downloadLocation; String? get downloadLocation => _$this._downloadLocation;
set downloadLocation(String downloadLocation) => set downloadLocation(String? downloadLocation) =>
_$this._downloadLocation = downloadLocation; _$this._downloadLocation = downloadLocation;
LinksBuilder(); LinksBuilder();
@ -180,7 +180,7 @@ class LinksBuilder implements Builder<Links, LinksBuilder> {
} }
@override @override
void update(void Function(LinksBuilder) updates) { void update(void Function(LinksBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -13,27 +13,24 @@ import 'position.dart';
part 'location.g.dart'; part 'location.g.dart';
abstract class Location implements Built<Location, LocationBuilder> { abstract class Location implements Built<Location, LocationBuilder> {
factory Location([void Function(LocationBuilder) updates]) = _$Location; factory Location([void Function(LocationBuilder)? updates]) = _$Location;
Location._(); Location._();
@nullable
@BuiltValueField(wireName: 'city') @BuiltValueField(wireName: 'city')
String get city; String? get city;
@nullable
@BuiltValueField(wireName: 'country') @BuiltValueField(wireName: 'country')
String get country; String? get country;
@nullable
@BuiltValueField(wireName: 'position') @BuiltValueField(wireName: 'position')
Position get position; Position? get position;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Location.serializer, this)); return json.encode(serializers.serializeWith(Location.serializer, this));
} }
static Location fromJson(String jsonString) { static Location? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Location.serializer, json.decode(jsonString)); Location.serializer, json.decode(jsonString));
} }

@ -19,10 +19,10 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
final String wireName = 'Location'; final String wireName = 'Location';
@override @override
Iterable<Object> serialize(Serializers serializers, Location object, Iterable<Object?> serialize(Serializers serializers, Location object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[]; final result = <Object?>[];
Object value; Object? value;
value = object.city; value = object.city;
if (value != null) { if (value != null) {
result result
@ -48,7 +48,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
} }
@override @override
Location deserialize(Serializers serializers, Iterable<Object> serialized, Location deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new LocationBuilder(); final result = new LocationBuilder();
@ -56,7 +56,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'city': case 'city':
result.city = serializers.deserialize(value, result.city = serializers.deserialize(value,
@ -68,7 +68,7 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
break; break;
case 'position': case 'position':
result.position.replace(serializers.deserialize(value, result.position.replace(serializers.deserialize(value,
specifiedType: const FullType(Position)) as Position); specifiedType: const FullType(Position))! as Position);
break; break;
} }
} }
@ -79,13 +79,13 @@ class _$LocationSerializer implements StructuredSerializer<Location> {
class _$Location extends Location { class _$Location extends Location {
@override @override
final String city; final String? city;
@override @override
final String country; final String? country;
@override @override
final Position position; final Position? position;
factory _$Location([void Function(LocationBuilder) updates]) => factory _$Location([void Function(LocationBuilder)? updates]) =>
(new LocationBuilder()..update(updates)).build(); (new LocationBuilder()..update(updates)).build();
_$Location._({this.city, this.country, this.position}) : super._(); _$Location._({this.city, this.country, this.position}) : super._();
@ -123,19 +123,19 @@ class _$Location extends Location {
} }
class LocationBuilder implements Builder<Location, LocationBuilder> { class LocationBuilder implements Builder<Location, LocationBuilder> {
_$Location _$v; _$Location? _$v;
String _city; String? _city;
String get city => _$this._city; String? get city => _$this._city;
set city(String city) => _$this._city = city; set city(String? city) => _$this._city = city;
String _country; String? _country;
String get country => _$this._country; String? get country => _$this._country;
set country(String country) => _$this._country = country; set country(String? country) => _$this._country = country;
PositionBuilder _position; PositionBuilder? _position;
PositionBuilder get position => _$this._position ??= new PositionBuilder(); PositionBuilder get position => _$this._position ??= new PositionBuilder();
set position(PositionBuilder position) => _$this._position = position; set position(PositionBuilder? position) => _$this._position = position;
LocationBuilder(); LocationBuilder();
@ -157,7 +157,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
} }
@override @override
void update(void Function(LocationBuilder) updates) { void update(void Function(LocationBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -169,7 +169,7 @@ class LocationBuilder implements Builder<Location, LocationBuilder> {
new _$Location._( new _$Location._(
city: city, country: country, position: _position?.build()); city: city, country: country, position: _position?.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'position'; _$failedField = 'position';
_position?.build(); _position?.build();

@ -20,82 +20,66 @@ import 'user.dart';
part 'photo.g.dart'; part 'photo.g.dart';
abstract class Photo implements Built<Photo, PhotoBuilder> { abstract class Photo implements Built<Photo, PhotoBuilder> {
factory Photo([void Function(PhotoBuilder) updates]) = _$Photo; factory Photo([void Function(PhotoBuilder)? updates]) = _$Photo;
Photo._(); Photo._();
@BuiltValueField(wireName: 'id') @BuiltValueField(wireName: 'id')
String get id; String get id;
@nullable
@BuiltValueField(wireName: 'created_at') @BuiltValueField(wireName: 'created_at')
String get createdAt; String? get createdAt;
@nullable
@BuiltValueField(wireName: 'updated_at') @BuiltValueField(wireName: 'updated_at')
String get updatedAt; String? get updatedAt;
@nullable
@BuiltValueField(wireName: 'width') @BuiltValueField(wireName: 'width')
int get width; int? get width;
@nullable
@BuiltValueField(wireName: 'height') @BuiltValueField(wireName: 'height')
int get height; int? get height;
@nullable
@BuiltValueField(wireName: 'color') @BuiltValueField(wireName: 'color')
String get color; String? get color;
@nullable
@BuiltValueField(wireName: 'downloads') @BuiltValueField(wireName: 'downloads')
int get downloads; int? get downloads;
@nullable
@BuiltValueField(wireName: 'likes') @BuiltValueField(wireName: 'likes')
int get likes; int? get likes;
@nullable
@BuiltValueField(wireName: 'liked_by_user') @BuiltValueField(wireName: 'liked_by_user')
bool get likedByUser; bool? get likedByUser;
@nullable
@BuiltValueField(wireName: 'description') @BuiltValueField(wireName: 'description')
String get description; String? get description;
@nullable
@BuiltValueField(wireName: 'exif') @BuiltValueField(wireName: 'exif')
Exif get exif; Exif? get exif;
@nullable
@BuiltValueField(wireName: 'location') @BuiltValueField(wireName: 'location')
Location get location; Location? get location;
@nullable
@BuiltValueField(wireName: 'tags') @BuiltValueField(wireName: 'tags')
BuiltList<Tags> get tags; BuiltList<Tags>? get tags;
@nullable
@BuiltValueField(wireName: 'current_user_collections') @BuiltValueField(wireName: 'current_user_collections')
BuiltList<CurrentUserCollections> get currentUserCollections; BuiltList<CurrentUserCollections>? get currentUserCollections;
@nullable
@BuiltValueField(wireName: 'urls') @BuiltValueField(wireName: 'urls')
Urls get urls; Urls? get urls;
@nullable
@BuiltValueField(wireName: 'links') @BuiltValueField(wireName: 'links')
Links get links; Links? get links;
@nullable
@BuiltValueField(wireName: 'user') @BuiltValueField(wireName: 'user')
User get user; User? get user;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Photo.serializer, this)); return json.encode(serializers.serializeWith(Photo.serializer, this));
} }
static Photo fromJson(String jsonString) { static Photo? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Photo.serializer, json.decode(jsonString)); Photo.serializer, json.decode(jsonString));
} }

@ -19,13 +19,13 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
final String wireName = 'Photo'; final String wireName = 'Photo';
@override @override
Iterable<Object> serialize(Serializers serializers, Photo object, Iterable<Object?> serialize(Serializers serializers, Photo object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(object.id, specifiedType: const FullType(String)),
]; ];
Object value; Object? value;
value = object.createdAt; value = object.createdAt;
if (value != null) { if (value != null) {
result result
@ -140,7 +140,7 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
} }
@override @override
Photo deserialize(Serializers serializers, Iterable<Object> serialized, Photo deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new PhotoBuilder(); final result = new PhotoBuilder();
@ -148,7 +148,7 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'id': case 'id':
result.id = serializers.deserialize(value, result.id = serializers.deserialize(value,
@ -192,35 +192,35 @@ class _$PhotoSerializer implements StructuredSerializer<Photo> {
break; break;
case 'exif': case 'exif':
result.exif.replace(serializers.deserialize(value, result.exif.replace(serializers.deserialize(value,
specifiedType: const FullType(Exif)) as Exif); specifiedType: const FullType(Exif))! as Exif);
break; break;
case 'location': case 'location':
result.location.replace(serializers.deserialize(value, result.location.replace(serializers.deserialize(value,
specifiedType: const FullType(Location)) as Location); specifiedType: const FullType(Location))! as Location);
break; break;
case 'tags': case 'tags':
result.tags.replace(serializers.deserialize(value, result.tags.replace(serializers.deserialize(value,
specifiedType: specifiedType:
const FullType(BuiltList, const [const FullType(Tags)])) const FullType(BuiltList, const [const FullType(Tags)]))!
as BuiltList<Object>); as BuiltList<Object>);
break; break;
case 'current_user_collections': case 'current_user_collections':
result.currentUserCollections.replace(serializers.deserialize(value, result.currentUserCollections.replace(serializers.deserialize(value,
specifiedType: const FullType(BuiltList, const [ specifiedType: const FullType(BuiltList, const [
const FullType(CurrentUserCollections) const FullType(CurrentUserCollections)
])) as BuiltList<Object>); ]))! as BuiltList<Object>);
break; break;
case 'urls': case 'urls':
result.urls.replace(serializers.deserialize(value, result.urls.replace(serializers.deserialize(value,
specifiedType: const FullType(Urls)) as Urls); specifiedType: const FullType(Urls))! as Urls);
break; break;
case 'links': case 'links':
result.links.replace(serializers.deserialize(value, result.links.replace(serializers.deserialize(value,
specifiedType: const FullType(Links)) as Links); specifiedType: const FullType(Links))! as Links);
break; break;
case 'user': case 'user':
result.user.replace(serializers.deserialize(value, result.user.replace(serializers.deserialize(value,
specifiedType: const FullType(User)) as User); specifiedType: const FullType(User))! as User);
break; break;
} }
} }
@ -233,43 +233,43 @@ class _$Photo extends Photo {
@override @override
final String id; final String id;
@override @override
final String createdAt; final String? createdAt;
@override @override
final String updatedAt; final String? updatedAt;
@override @override
final int width; final int? width;
@override @override
final int height; final int? height;
@override @override
final String color; final String? color;
@override @override
final int downloads; final int? downloads;
@override @override
final int likes; final int? likes;
@override @override
final bool likedByUser; final bool? likedByUser;
@override @override
final String description; final String? description;
@override @override
final Exif exif; final Exif? exif;
@override @override
final Location location; final Location? location;
@override @override
final BuiltList<Tags> tags; final BuiltList<Tags>? tags;
@override @override
final BuiltList<CurrentUserCollections> currentUserCollections; final BuiltList<CurrentUserCollections>? currentUserCollections;
@override @override
final Urls urls; final Urls? urls;
@override @override
final Links links; final Links? links;
@override @override
final User user; final User? user;
factory _$Photo([void Function(PhotoBuilder) updates]) => factory _$Photo([void Function(PhotoBuilder)? updates]) =>
(new PhotoBuilder()..update(updates)).build(); (new PhotoBuilder()..update(updates)).build();
_$Photo._( _$Photo._(
{this.id, {required this.id,
this.createdAt, this.createdAt,
this.updatedAt, this.updatedAt,
this.width, this.width,
@ -387,79 +387,79 @@ class _$Photo extends Photo {
} }
class PhotoBuilder implements Builder<Photo, PhotoBuilder> { class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
_$Photo _$v; _$Photo? _$v;
String _id; String? _id;
String get id => _$this._id; String? get id => _$this._id;
set id(String id) => _$this._id = id; set id(String? id) => _$this._id = id;
String _createdAt; String? _createdAt;
String get createdAt => _$this._createdAt; String? get createdAt => _$this._createdAt;
set createdAt(String createdAt) => _$this._createdAt = createdAt; set createdAt(String? createdAt) => _$this._createdAt = createdAt;
String _updatedAt; String? _updatedAt;
String get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt; set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
int _width; int? _width;
int get width => _$this._width; int? get width => _$this._width;
set width(int width) => _$this._width = width; set width(int? width) => _$this._width = width;
int _height; int? _height;
int get height => _$this._height; int? get height => _$this._height;
set height(int height) => _$this._height = height; set height(int? height) => _$this._height = height;
String _color; String? _color;
String get color => _$this._color; String? get color => _$this._color;
set color(String color) => _$this._color = color; set color(String? color) => _$this._color = color;
int _downloads; int? _downloads;
int get downloads => _$this._downloads; int? get downloads => _$this._downloads;
set downloads(int downloads) => _$this._downloads = downloads; set downloads(int? downloads) => _$this._downloads = downloads;
int _likes; int? _likes;
int get likes => _$this._likes; int? get likes => _$this._likes;
set likes(int likes) => _$this._likes = likes; set likes(int? likes) => _$this._likes = likes;
bool _likedByUser; bool? _likedByUser;
bool get likedByUser => _$this._likedByUser; bool? get likedByUser => _$this._likedByUser;
set likedByUser(bool likedByUser) => _$this._likedByUser = likedByUser; set likedByUser(bool? likedByUser) => _$this._likedByUser = likedByUser;
String _description; String? _description;
String get description => _$this._description; String? get description => _$this._description;
set description(String description) => _$this._description = description; set description(String? description) => _$this._description = description;
ExifBuilder _exif; ExifBuilder? _exif;
ExifBuilder get exif => _$this._exif ??= new ExifBuilder(); ExifBuilder get exif => _$this._exif ??= new ExifBuilder();
set exif(ExifBuilder exif) => _$this._exif = exif; set exif(ExifBuilder? exif) => _$this._exif = exif;
LocationBuilder _location; LocationBuilder? _location;
LocationBuilder get location => _$this._location ??= new LocationBuilder(); LocationBuilder get location => _$this._location ??= new LocationBuilder();
set location(LocationBuilder location) => _$this._location = location; set location(LocationBuilder? location) => _$this._location = location;
ListBuilder<Tags> _tags; ListBuilder<Tags>? _tags;
ListBuilder<Tags> get tags => _$this._tags ??= new ListBuilder<Tags>(); ListBuilder<Tags> get tags => _$this._tags ??= new ListBuilder<Tags>();
set tags(ListBuilder<Tags> tags) => _$this._tags = tags; set tags(ListBuilder<Tags>? tags) => _$this._tags = tags;
ListBuilder<CurrentUserCollections> _currentUserCollections; ListBuilder<CurrentUserCollections>? _currentUserCollections;
ListBuilder<CurrentUserCollections> get currentUserCollections => ListBuilder<CurrentUserCollections> get currentUserCollections =>
_$this._currentUserCollections ??= _$this._currentUserCollections ??=
new ListBuilder<CurrentUserCollections>(); new ListBuilder<CurrentUserCollections>();
set currentUserCollections( set currentUserCollections(
ListBuilder<CurrentUserCollections> currentUserCollections) => ListBuilder<CurrentUserCollections>? currentUserCollections) =>
_$this._currentUserCollections = currentUserCollections; _$this._currentUserCollections = currentUserCollections;
UrlsBuilder _urls; UrlsBuilder? _urls;
UrlsBuilder get urls => _$this._urls ??= new UrlsBuilder(); UrlsBuilder get urls => _$this._urls ??= new UrlsBuilder();
set urls(UrlsBuilder urls) => _$this._urls = urls; set urls(UrlsBuilder? urls) => _$this._urls = urls;
LinksBuilder _links; LinksBuilder? _links;
LinksBuilder get links => _$this._links ??= new LinksBuilder(); LinksBuilder get links => _$this._links ??= new LinksBuilder();
set links(LinksBuilder links) => _$this._links = links; set links(LinksBuilder? links) => _$this._links = links;
UserBuilder _user; UserBuilder? _user;
UserBuilder get user => _$this._user ??= new UserBuilder(); UserBuilder get user => _$this._user ??= new UserBuilder();
set user(UserBuilder user) => _$this._user = user; set user(UserBuilder? user) => _$this._user = user;
PhotoBuilder(); PhotoBuilder();
@ -495,7 +495,7 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
} }
@override @override
void update(void Function(PhotoBuilder) updates) { void update(void Function(PhotoBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -523,7 +523,7 @@ class PhotoBuilder implements Builder<Photo, PhotoBuilder> {
links: _links?.build(), links: _links?.build(),
user: _user?.build()); user: _user?.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'exif'; _$failedField = 'exif';
_exif?.build(); _exif?.build();

@ -12,7 +12,7 @@ import '../serializers.dart';
part 'position.g.dart'; part 'position.g.dart';
abstract class Position implements Built<Position, PositionBuilder> { abstract class Position implements Built<Position, PositionBuilder> {
factory Position([void Function(PositionBuilder) updates]) = _$Position; factory Position([void Function(PositionBuilder)? updates]) = _$Position;
Position._(); Position._();
@ -26,7 +26,7 @@ abstract class Position implements Built<Position, PositionBuilder> {
return json.encode(serializers.serializeWith(Position.serializer, this)); return json.encode(serializers.serializeWith(Position.serializer, this));
} }
static Position fromJson(String jsonString) { static Position? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Position.serializer, json.decode(jsonString)); Position.serializer, json.decode(jsonString));
} }

@ -19,9 +19,9 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
final String wireName = 'Position'; final String wireName = 'Position';
@override @override
Iterable<Object> serialize(Serializers serializers, Position object, Iterable<Object?> serialize(Serializers serializers, Position object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'latitude', 'latitude',
serializers.serialize(object.latitude, serializers.serialize(object.latitude,
specifiedType: const FullType(double)), specifiedType: const FullType(double)),
@ -34,7 +34,7 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
} }
@override @override
Position deserialize(Serializers serializers, Iterable<Object> serialized, Position deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new PositionBuilder(); final result = new PositionBuilder();
@ -42,7 +42,7 @@ class _$PositionSerializer implements StructuredSerializer<Position> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'latitude': case 'latitude':
result.latitude = serializers.deserialize(value, result.latitude = serializers.deserialize(value,
@ -65,10 +65,10 @@ class _$Position extends Position {
@override @override
final double longitude; final double longitude;
factory _$Position([void Function(PositionBuilder) updates]) => factory _$Position([void Function(PositionBuilder)? updates]) =>
(new PositionBuilder()..update(updates)).build(); (new PositionBuilder()..update(updates)).build();
_$Position._({this.latitude, this.longitude}) : super._() { _$Position._({required this.latitude, required this.longitude}) : super._() {
BuiltValueNullFieldError.checkNotNull(latitude, 'Position', 'latitude'); BuiltValueNullFieldError.checkNotNull(latitude, 'Position', 'latitude');
BuiltValueNullFieldError.checkNotNull(longitude, 'Position', 'longitude'); BuiltValueNullFieldError.checkNotNull(longitude, 'Position', 'longitude');
} }
@ -103,15 +103,15 @@ class _$Position extends Position {
} }
class PositionBuilder implements Builder<Position, PositionBuilder> { class PositionBuilder implements Builder<Position, PositionBuilder> {
_$Position _$v; _$Position? _$v;
double _latitude; double? _latitude;
double get latitude => _$this._latitude; double? get latitude => _$this._latitude;
set latitude(double latitude) => _$this._latitude = latitude; set latitude(double? latitude) => _$this._latitude = latitude;
double _longitude; double? _longitude;
double get longitude => _$this._longitude; double? get longitude => _$this._longitude;
set longitude(double longitude) => _$this._longitude = longitude; set longitude(double? longitude) => _$this._longitude = longitude;
PositionBuilder(); PositionBuilder();
@ -132,7 +132,7 @@ class PositionBuilder implements Builder<Position, PositionBuilder> {
} }
@override @override
void update(void Function(PositionBuilder) updates) { void update(void Function(PositionBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -16,18 +16,16 @@ part 'search_photos_response.g.dart';
abstract class SearchPhotosResponse abstract class SearchPhotosResponse
implements Built<SearchPhotosResponse, SearchPhotosResponseBuilder> { implements Built<SearchPhotosResponse, SearchPhotosResponseBuilder> {
factory SearchPhotosResponse( factory SearchPhotosResponse(
[void Function(SearchPhotosResponseBuilder) updates]) = [void Function(SearchPhotosResponseBuilder)? updates]) =
_$SearchPhotosResponse; _$SearchPhotosResponse;
SearchPhotosResponse._(); SearchPhotosResponse._();
@nullable
@BuiltValueField(wireName: 'total') @BuiltValueField(wireName: 'total')
int get total; int? get total;
@nullable
@BuiltValueField(wireName: 'total_pages') @BuiltValueField(wireName: 'total_pages')
int get totalPages; int? get totalPages;
@BuiltValueField(wireName: 'results') @BuiltValueField(wireName: 'results')
BuiltList<Photo> get results; BuiltList<Photo> get results;
@ -37,7 +35,7 @@ abstract class SearchPhotosResponse
serializers.serializeWith(SearchPhotosResponse.serializer, this)); serializers.serializeWith(SearchPhotosResponse.serializer, this));
} }
static SearchPhotosResponse fromJson(String jsonString) { static SearchPhotosResponse? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
SearchPhotosResponse.serializer, json.decode(jsonString)); SearchPhotosResponse.serializer, json.decode(jsonString));
} }

@ -24,16 +24,16 @@ class _$SearchPhotosResponseSerializer
final String wireName = 'SearchPhotosResponse'; final String wireName = 'SearchPhotosResponse';
@override @override
Iterable<Object> serialize( Iterable<Object?> serialize(
Serializers serializers, SearchPhotosResponse object, Serializers serializers, SearchPhotosResponse object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'results', 'results',
serializers.serialize(object.results, serializers.serialize(object.results,
specifiedType: specifiedType:
const FullType(BuiltList, const [const FullType(Photo)])), const FullType(BuiltList, const [const FullType(Photo)])),
]; ];
Object value; Object? value;
value = object.total; value = object.total;
if (value != null) { if (value != null) {
result result
@ -51,7 +51,7 @@ class _$SearchPhotosResponseSerializer
@override @override
SearchPhotosResponse deserialize( SearchPhotosResponse deserialize(
Serializers serializers, Iterable<Object> serialized, Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new SearchPhotosResponseBuilder(); final result = new SearchPhotosResponseBuilder();
@ -59,7 +59,7 @@ class _$SearchPhotosResponseSerializer
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'total': case 'total':
result.total = serializers.deserialize(value, result.total = serializers.deserialize(value,
@ -72,7 +72,7 @@ class _$SearchPhotosResponseSerializer
case 'results': case 'results':
result.results.replace(serializers.deserialize(value, result.results.replace(serializers.deserialize(value,
specifiedType: specifiedType:
const FullType(BuiltList, const [const FullType(Photo)])) const FullType(BuiltList, const [const FullType(Photo)]))!
as BuiltList<Object>); as BuiltList<Object>);
break; break;
} }
@ -84,17 +84,17 @@ class _$SearchPhotosResponseSerializer
class _$SearchPhotosResponse extends SearchPhotosResponse { class _$SearchPhotosResponse extends SearchPhotosResponse {
@override @override
final int total; final int? total;
@override @override
final int totalPages; final int? totalPages;
@override @override
final BuiltList<Photo> results; final BuiltList<Photo> results;
factory _$SearchPhotosResponse( factory _$SearchPhotosResponse(
[void Function(SearchPhotosResponseBuilder) updates]) => [void Function(SearchPhotosResponseBuilder)? updates]) =>
(new SearchPhotosResponseBuilder()..update(updates)).build(); (new SearchPhotosResponseBuilder()..update(updates)).build();
_$SearchPhotosResponse._({this.total, this.totalPages, this.results}) _$SearchPhotosResponse._({this.total, this.totalPages, required this.results})
: super._() { : super._() {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
results, 'SearchPhotosResponse', 'results'); results, 'SearchPhotosResponse', 'results');
@ -136,20 +136,20 @@ class _$SearchPhotosResponse extends SearchPhotosResponse {
class SearchPhotosResponseBuilder class SearchPhotosResponseBuilder
implements Builder<SearchPhotosResponse, SearchPhotosResponseBuilder> { implements Builder<SearchPhotosResponse, SearchPhotosResponseBuilder> {
_$SearchPhotosResponse _$v; _$SearchPhotosResponse? _$v;
int _total; int? _total;
int get total => _$this._total; int? get total => _$this._total;
set total(int total) => _$this._total = total; set total(int? total) => _$this._total = total;
int _totalPages; int? _totalPages;
int get totalPages => _$this._totalPages; int? get totalPages => _$this._totalPages;
set totalPages(int totalPages) => _$this._totalPages = totalPages; set totalPages(int? totalPages) => _$this._totalPages = totalPages;
ListBuilder<Photo> _results; ListBuilder<Photo>? _results;
ListBuilder<Photo> get results => ListBuilder<Photo> get results =>
_$this._results ??= new ListBuilder<Photo>(); _$this._results ??= new ListBuilder<Photo>();
set results(ListBuilder<Photo> results) => _$this._results = results; set results(ListBuilder<Photo>? results) => _$this._results = results;
SearchPhotosResponseBuilder(); SearchPhotosResponseBuilder();
@ -171,7 +171,7 @@ class SearchPhotosResponseBuilder
} }
@override @override
void update(void Function(SearchPhotosResponseBuilder) updates) { void update(void Function(SearchPhotosResponseBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -183,7 +183,7 @@ class SearchPhotosResponseBuilder
new _$SearchPhotosResponse._( new _$SearchPhotosResponse._(
total: total, totalPages: totalPages, results: results.build()); total: total, totalPages: totalPages, results: results.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'results'; _$failedField = 'results';
results.build(); results.build();

@ -12,7 +12,7 @@ import '../serializers.dart';
part 'tags.g.dart'; part 'tags.g.dart';
abstract class Tags implements Built<Tags, TagsBuilder> { abstract class Tags implements Built<Tags, TagsBuilder> {
factory Tags([void Function(TagsBuilder) updates]) = _$Tags; factory Tags([void Function(TagsBuilder)? updates]) = _$Tags;
Tags._(); Tags._();
@ -23,7 +23,7 @@ abstract class Tags implements Built<Tags, TagsBuilder> {
return json.encode(serializers.serializeWith(Tags.serializer, this)); return json.encode(serializers.serializeWith(Tags.serializer, this));
} }
static Tags fromJson(String jsonString) { static Tags? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Tags.serializer, json.decode(jsonString)); Tags.serializer, json.decode(jsonString));
} }

@ -19,9 +19,9 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
final String wireName = 'Tags'; final String wireName = 'Tags';
@override @override
Iterable<Object> serialize(Serializers serializers, Tags object, Iterable<Object?> serialize(Serializers serializers, Tags object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'title', 'title',
serializers.serialize(object.title, serializers.serialize(object.title,
specifiedType: const FullType(String)), specifiedType: const FullType(String)),
@ -31,7 +31,7 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
} }
@override @override
Tags deserialize(Serializers serializers, Iterable<Object> serialized, Tags deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new TagsBuilder(); final result = new TagsBuilder();
@ -39,7 +39,7 @@ class _$TagsSerializer implements StructuredSerializer<Tags> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'title': case 'title':
result.title = serializers.deserialize(value, result.title = serializers.deserialize(value,
@ -56,10 +56,10 @@ class _$Tags extends Tags {
@override @override
final String title; final String title;
factory _$Tags([void Function(TagsBuilder) updates]) => factory _$Tags([void Function(TagsBuilder)? updates]) =>
(new TagsBuilder()..update(updates)).build(); (new TagsBuilder()..update(updates)).build();
_$Tags._({this.title}) : super._() { _$Tags._({required this.title}) : super._() {
BuiltValueNullFieldError.checkNotNull(title, 'Tags', 'title'); BuiltValueNullFieldError.checkNotNull(title, 'Tags', 'title');
} }
@ -89,11 +89,11 @@ class _$Tags extends Tags {
} }
class TagsBuilder implements Builder<Tags, TagsBuilder> { class TagsBuilder implements Builder<Tags, TagsBuilder> {
_$Tags _$v; _$Tags? _$v;
String _title; String? _title;
String get title => _$this._title; String? get title => _$this._title;
set title(String title) => _$this._title = title; set title(String? title) => _$this._title = title;
TagsBuilder(); TagsBuilder();
@ -113,7 +113,7 @@ class TagsBuilder implements Builder<Tags, TagsBuilder> {
} }
@override @override
void update(void Function(TagsBuilder) updates) { void update(void Function(TagsBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -7,7 +7,6 @@ import 'dart:typed_data';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:pedantic/pedantic.dart'; import 'package:pedantic/pedantic.dart';
import 'api_error.dart'; import 'api_error.dart';
@ -21,30 +20,28 @@ final _unsplashBaseUrl = Uri.parse('https://api.unsplash.com/');
/// requests to the Unsplash API. /// requests to the Unsplash API.
class Unsplash { class Unsplash {
Unsplash({ Unsplash({
@required String accessKey, required String accessKey,
http.BaseClient httpClient, http.BaseClient? httpClient,
}) : assert(accessKey != null, 'accessKey must not be null'), }) : _accessKey = accessKey,
_accessKey = accessKey,
_client = httpClient ?? http.Client(); _client = httpClient ?? http.Client();
final String _accessKey; final String _accessKey;
final http.Client _client; final http.Client _client;
final _log = Logger('Unsplash'); final _log = Logger('Unsplash');
Future<SearchPhotosResponse> searchPhotos({ Future<SearchPhotosResponse?> searchPhotos({
@required String query, required String query,
num page = 1, num page = 1,
num perPage = 10, num perPage = 10,
List<num> collections = const [], List<num> collections = const [],
SearchPhotosOrientation orientation, SearchPhotosOrientation? orientation,
}) async { }) async {
final searchPhotosUrl = _unsplashBaseUrl final searchPhotosUrl = _unsplashBaseUrl
.replace(path: '/search/photos', queryParameters: <String, String>{ .replace(path: '/search/photos', queryParameters: <String, String>{
'query': query, 'query': query,
if (page != 1) 'page': '$page', if (page != 1) 'page': '$page',
if (perPage != 10) 'per_page': '$perPage', if (perPage != 10) 'per_page': '$perPage',
if (collections != null && collections.isNotEmpty) if (collections.isNotEmpty) 'collections': collections.join(','),
'collections': '${collections.join(',')}',
if (orientation == SearchPhotosOrientation.landscape) if (orientation == SearchPhotosOrientation.landscape)
'orientation': 'landscape', 'orientation': 'landscape',
if (orientation == SearchPhotosOrientation.portrait) if (orientation == SearchPhotosOrientation.portrait)
@ -72,8 +69,8 @@ class Unsplash {
if (body is Map && if (body is Map &&
body['errors'] is List && body['errors'] is List &&
body['errors'].isNotEmpty as bool) { body['errors'].isNotEmpty as bool) {
final apiError = ApiError.fromJson(response.body); final apiError = ApiError.fromJson(response.body)!;
throw UnsplashException(apiError.errors.join(', ')); throw UnsplashException(apiError.errors!.join(', '));
} }
return SearchPhotosResponse.fromJson( return SearchPhotosResponse.fromJson(
@ -85,14 +82,14 @@ class Unsplash {
// For detail on how downloading photos from Unsplash, please see // For detail on how downloading photos from Unsplash, please see
// https://help.unsplash.com/en/articles/2511258-guideline-triggering-a-download // https://help.unsplash.com/en/articles/2511258-guideline-triggering-a-download
_log.info('GET ${photo.urls.full}'); _log.info('GET ${photo.urls!.full}');
final futureBytes = http.readBytes(Uri.parse(photo.urls.full), headers: { final futureBytes = http.readBytes(Uri.parse(photo.urls!.full!), headers: {
'Accept-Version': 'v1', 'Accept-Version': 'v1',
'Authorization': 'Client-ID $_accessKey', 'Authorization': 'Client-ID $_accessKey',
}); });
_log.info('GET ${photo.links.downloadLocation}'); _log.info('GET ${photo.links!.downloadLocation}');
unawaited(http.get(Uri.parse(photo.links.downloadLocation), headers: { unawaited(http.get(Uri.parse(photo.links!.downloadLocation!), headers: {
'Accept-Version': 'v1', 'Accept-Version': 'v1',
'Authorization': 'Client-ID $_accessKey', 'Authorization': 'Client-ID $_accessKey',
})); }));
@ -110,7 +107,7 @@ enum SearchPhotosOrientation {
class UnsplashException implements Exception { class UnsplashException implements Exception {
UnsplashException([this.message]); UnsplashException([this.message]);
final String message; final String? message;
@override @override
String toString() { String toString() {

@ -12,35 +12,30 @@ import '../serializers.dart';
part 'urls.g.dart'; part 'urls.g.dart';
abstract class Urls implements Built<Urls, UrlsBuilder> { abstract class Urls implements Built<Urls, UrlsBuilder> {
factory Urls([void Function(UrlsBuilder b) updates]) = _$Urls; factory Urls([void Function(UrlsBuilder b)? updates]) = _$Urls;
Urls._(); Urls._();
@nullable
@BuiltValueField(wireName: 'raw') @BuiltValueField(wireName: 'raw')
String get raw; String? get raw;
@nullable
@BuiltValueField(wireName: 'full') @BuiltValueField(wireName: 'full')
String get full; String? get full;
@nullable
@BuiltValueField(wireName: 'regular') @BuiltValueField(wireName: 'regular')
String get regular; String? get regular;
@nullable
@BuiltValueField(wireName: 'small') @BuiltValueField(wireName: 'small')
String get small; String? get small;
@nullable
@BuiltValueField(wireName: 'thumb') @BuiltValueField(wireName: 'thumb')
String get thumb; String? get thumb;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(Urls.serializer, this)); return json.encode(serializers.serializeWith(Urls.serializer, this));
} }
static Urls fromJson(String jsonString) { static Urls? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
Urls.serializer, json.decode(jsonString)); Urls.serializer, json.decode(jsonString));
} }

@ -19,10 +19,10 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
final String wireName = 'Urls'; final String wireName = 'Urls';
@override @override
Iterable<Object> serialize(Serializers serializers, Urls object, Iterable<Object?> serialize(Serializers serializers, Urls object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[]; final result = <Object?>[];
Object value; Object? value;
value = object.raw; value = object.raw;
if (value != null) { if (value != null) {
result result
@ -62,7 +62,7 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
} }
@override @override
Urls deserialize(Serializers serializers, Iterable<Object> serialized, Urls deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new UrlsBuilder(); final result = new UrlsBuilder();
@ -70,7 +70,7 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'raw': case 'raw':
result.raw = serializers.deserialize(value, result.raw = serializers.deserialize(value,
@ -101,17 +101,17 @@ class _$UrlsSerializer implements StructuredSerializer<Urls> {
class _$Urls extends Urls { class _$Urls extends Urls {
@override @override
final String raw; final String? raw;
@override @override
final String full; final String? full;
@override @override
final String regular; final String? regular;
@override @override
final String small; final String? small;
@override @override
final String thumb; final String? thumb;
factory _$Urls([void Function(UrlsBuilder) updates]) => factory _$Urls([void Function(UrlsBuilder)? updates]) =>
(new UrlsBuilder()..update(updates)).build(); (new UrlsBuilder()..update(updates)).build();
_$Urls._({this.raw, this.full, this.regular, this.small, this.thumb}) _$Urls._({this.raw, this.full, this.regular, this.small, this.thumb})
@ -156,27 +156,27 @@ class _$Urls extends Urls {
} }
class UrlsBuilder implements Builder<Urls, UrlsBuilder> { class UrlsBuilder implements Builder<Urls, UrlsBuilder> {
_$Urls _$v; _$Urls? _$v;
String _raw; String? _raw;
String get raw => _$this._raw; String? get raw => _$this._raw;
set raw(String raw) => _$this._raw = raw; set raw(String? raw) => _$this._raw = raw;
String _full; String? _full;
String get full => _$this._full; String? get full => _$this._full;
set full(String full) => _$this._full = full; set full(String? full) => _$this._full = full;
String _regular; String? _regular;
String get regular => _$this._regular; String? get regular => _$this._regular;
set regular(String regular) => _$this._regular = regular; set regular(String? regular) => _$this._regular = regular;
String _small; String? _small;
String get small => _$this._small; String? get small => _$this._small;
set small(String small) => _$this._small = small; set small(String? small) => _$this._small = small;
String _thumb; String? _thumb;
String get thumb => _$this._thumb; String? get thumb => _$this._thumb;
set thumb(String thumb) => _$this._thumb = thumb; set thumb(String? thumb) => _$this._thumb = thumb;
UrlsBuilder(); UrlsBuilder();
@ -200,7 +200,7 @@ class UrlsBuilder implements Builder<Urls, UrlsBuilder> {
} }
@override @override
void update(void Function(UrlsBuilder) updates) { void update(void Function(UrlsBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }

@ -13,16 +13,15 @@ import 'links.dart';
part 'user.g.dart'; part 'user.g.dart';
abstract class User implements Built<User, UserBuilder> { abstract class User implements Built<User, UserBuilder> {
factory User([void Function(UserBuilder) updates]) = _$User; factory User([void Function(UserBuilder)? updates]) = _$User;
User._(); User._();
@BuiltValueField(wireName: 'id') @BuiltValueField(wireName: 'id')
String get id; String get id;
@nullable
@BuiltValueField(wireName: 'updated_at') @BuiltValueField(wireName: 'updated_at')
String get updatedAt; String? get updatedAt;
@BuiltValueField(wireName: 'username') @BuiltValueField(wireName: 'username')
String get username; String get username;
@ -30,39 +29,32 @@ abstract class User implements Built<User, UserBuilder> {
@BuiltValueField(wireName: 'name') @BuiltValueField(wireName: 'name')
String get name; String get name;
@nullable
@BuiltValueField(wireName: 'portfolio_url') @BuiltValueField(wireName: 'portfolio_url')
String get portfolioUrl; String? get portfolioUrl;
@nullable
@BuiltValueField(wireName: 'bio') @BuiltValueField(wireName: 'bio')
String get bio; String? get bio;
@nullable
@BuiltValueField(wireName: 'location') @BuiltValueField(wireName: 'location')
String get location; String? get location;
@nullable
@BuiltValueField(wireName: 'total_likes') @BuiltValueField(wireName: 'total_likes')
int get totalLikes; int? get totalLikes;
@nullable
@BuiltValueField(wireName: 'total_photos') @BuiltValueField(wireName: 'total_photos')
int get totalPhotos; int? get totalPhotos;
@nullable
@BuiltValueField(wireName: 'total_collections') @BuiltValueField(wireName: 'total_collections')
int get totalCollections; int? get totalCollections;
@nullable
@BuiltValueField(wireName: 'links') @BuiltValueField(wireName: 'links')
Links get links; Links? get links;
String toJson() { String toJson() {
return json.encode(serializers.serializeWith(User.serializer, this)); return json.encode(serializers.serializeWith(User.serializer, this));
} }
static User fromJson(String jsonString) { static User? fromJson(String jsonString) {
return serializers.deserializeWith( return serializers.deserializeWith(
User.serializer, json.decode(jsonString)); User.serializer, json.decode(jsonString));
} }

@ -19,9 +19,9 @@ class _$UserSerializer implements StructuredSerializer<User> {
final String wireName = 'User'; final String wireName = 'User';
@override @override
Iterable<Object> serialize(Serializers serializers, User object, Iterable<Object?> serialize(Serializers serializers, User object,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = <Object>[ final result = <Object?>[
'id', 'id',
serializers.serialize(object.id, specifiedType: const FullType(String)), serializers.serialize(object.id, specifiedType: const FullType(String)),
'username', 'username',
@ -30,7 +30,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
'name', 'name',
serializers.serialize(object.name, specifiedType: const FullType(String)), serializers.serialize(object.name, specifiedType: const FullType(String)),
]; ];
Object value; Object? value;
value = object.updatedAt; value = object.updatedAt;
if (value != null) { if (value != null) {
result result
@ -88,7 +88,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
} }
@override @override
User deserialize(Serializers serializers, Iterable<Object> serialized, User deserialize(Serializers serializers, Iterable<Object?> serialized,
{FullType specifiedType = FullType.unspecified}) { {FullType specifiedType = FullType.unspecified}) {
final result = new UserBuilder(); final result = new UserBuilder();
@ -96,7 +96,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
while (iterator.moveNext()) { while (iterator.moveNext()) {
final key = iterator.current as String; final key = iterator.current as String;
iterator.moveNext(); iterator.moveNext();
final Object value = iterator.current; final Object? value = iterator.current;
switch (key) { switch (key) {
case 'id': case 'id':
result.id = serializers.deserialize(value, result.id = serializers.deserialize(value,
@ -140,7 +140,7 @@ class _$UserSerializer implements StructuredSerializer<User> {
break; break;
case 'links': case 'links':
result.links.replace(serializers.deserialize(value, result.links.replace(serializers.deserialize(value,
specifiedType: const FullType(Links)) as Links); specifiedType: const FullType(Links))! as Links);
break; break;
} }
} }
@ -153,34 +153,34 @@ class _$User extends User {
@override @override
final String id; final String id;
@override @override
final String updatedAt; final String? updatedAt;
@override @override
final String username; final String username;
@override @override
final String name; final String name;
@override @override
final String portfolioUrl; final String? portfolioUrl;
@override @override
final String bio; final String? bio;
@override @override
final String location; final String? location;
@override @override
final int totalLikes; final int? totalLikes;
@override @override
final int totalPhotos; final int? totalPhotos;
@override @override
final int totalCollections; final int? totalCollections;
@override @override
final Links links; final Links? links;
factory _$User([void Function(UserBuilder) updates]) => factory _$User([void Function(UserBuilder)? updates]) =>
(new UserBuilder()..update(updates)).build(); (new UserBuilder()..update(updates)).build();
_$User._( _$User._(
{this.id, {required this.id,
this.updatedAt, this.updatedAt,
this.username, required this.username,
this.name, required this.name,
this.portfolioUrl, this.portfolioUrl,
this.bio, this.bio,
this.location, this.location,
@ -261,52 +261,52 @@ class _$User extends User {
} }
class UserBuilder implements Builder<User, UserBuilder> { class UserBuilder implements Builder<User, UserBuilder> {
_$User _$v; _$User? _$v;
String _id; String? _id;
String get id => _$this._id; String? get id => _$this._id;
set id(String id) => _$this._id = id; set id(String? id) => _$this._id = id;
String _updatedAt; String? _updatedAt;
String get updatedAt => _$this._updatedAt; String? get updatedAt => _$this._updatedAt;
set updatedAt(String updatedAt) => _$this._updatedAt = updatedAt; set updatedAt(String? updatedAt) => _$this._updatedAt = updatedAt;
String _username; String? _username;
String get username => _$this._username; String? get username => _$this._username;
set username(String username) => _$this._username = username; set username(String? username) => _$this._username = username;
String _name; String? _name;
String get name => _$this._name; String? get name => _$this._name;
set name(String name) => _$this._name = name; set name(String? name) => _$this._name = name;
String _portfolioUrl; String? _portfolioUrl;
String get portfolioUrl => _$this._portfolioUrl; String? get portfolioUrl => _$this._portfolioUrl;
set portfolioUrl(String portfolioUrl) => _$this._portfolioUrl = portfolioUrl; set portfolioUrl(String? portfolioUrl) => _$this._portfolioUrl = portfolioUrl;
String _bio; String? _bio;
String get bio => _$this._bio; String? get bio => _$this._bio;
set bio(String bio) => _$this._bio = bio; set bio(String? bio) => _$this._bio = bio;
String _location; String? _location;
String get location => _$this._location; String? get location => _$this._location;
set location(String location) => _$this._location = location; set location(String? location) => _$this._location = location;
int _totalLikes; int? _totalLikes;
int get totalLikes => _$this._totalLikes; int? get totalLikes => _$this._totalLikes;
set totalLikes(int totalLikes) => _$this._totalLikes = totalLikes; set totalLikes(int? totalLikes) => _$this._totalLikes = totalLikes;
int _totalPhotos; int? _totalPhotos;
int get totalPhotos => _$this._totalPhotos; int? get totalPhotos => _$this._totalPhotos;
set totalPhotos(int totalPhotos) => _$this._totalPhotos = totalPhotos; set totalPhotos(int? totalPhotos) => _$this._totalPhotos = totalPhotos;
int _totalCollections; int? _totalCollections;
int get totalCollections => _$this._totalCollections; int? get totalCollections => _$this._totalCollections;
set totalCollections(int totalCollections) => set totalCollections(int? totalCollections) =>
_$this._totalCollections = totalCollections; _$this._totalCollections = totalCollections;
LinksBuilder _links; LinksBuilder? _links;
LinksBuilder get links => _$this._links ??= new LinksBuilder(); LinksBuilder get links => _$this._links ??= new LinksBuilder();
set links(LinksBuilder links) => _$this._links = links; set links(LinksBuilder? links) => _$this._links = links;
UserBuilder(); UserBuilder();
@ -336,7 +336,7 @@ class UserBuilder implements Builder<User, UserBuilder> {
} }
@override @override
void update(void Function(UserBuilder) updates) { void update(void Function(UserBuilder)? updates) {
if (updates != null) updates(this); if (updates != null) updates(this);
} }
@ -359,7 +359,7 @@ class UserBuilder implements Builder<User, UserBuilder> {
totalCollections: totalCollections, totalCollections: totalCollections,
links: _links?.build()); links: _links?.build());
} catch (_) { } catch (_) {
String _$failedField; late String _$failedField;
try { try {
_$failedField = 'links'; _$failedField = 'links';
_links?.build(); _links?.build();

@ -7,8 +7,8 @@ import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as url_launcher; import 'package:url_launcher/url_launcher.dart' as url_launcher;
class PolicyDialog extends StatelessWidget { class PolicyDialog extends StatelessWidget {
PolicyDialog({ const PolicyDialog({
Key key, Key? key,
this.radius = 8, this.radius = 8,
}) : super(key: key); }) : super(key: key);
@ -23,7 +23,7 @@ class PolicyDialog extends StatelessWidget {
builder: (context) { builder: (context) {
var height = MediaQuery.of(context).size.height; var height = MediaQuery.of(context).size.height;
var width = MediaQuery.of(context).size.width; var width = MediaQuery.of(context).size.width;
return Container( return SizedBox(
height: height / 4, height: height / 4,
width: width / 4, width: width / 4,
child: Column( child: Column(
@ -41,16 +41,16 @@ class PolicyDialog extends StatelessWidget {
textAlign: TextAlign.left, textAlign: TextAlign.left,
text: TextSpan( text: TextSpan(
text: '', text: '',
style: TextStyle(color: Colors.black, fontSize: 18), style: const TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: 'https://policies.google.com/terms', text: 'https://policies.google.com/terms',
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.lightBlue), color: Colors.lightBlue),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () async { ..onTap = () async {
final url = 'https://policies.google.com/terms'; const url = 'https://policies.google.com/terms';
if (await url_launcher.canLaunch(url)) { if (await url_launcher.canLaunch(url)) {
await url_launcher.launch(url); await url_launcher.launch(url);
} }
@ -63,16 +63,16 @@ class PolicyDialog extends StatelessWidget {
textAlign: TextAlign.left, textAlign: TextAlign.left,
text: TextSpan( text: TextSpan(
text: '', text: '',
style: TextStyle(color: Colors.black, fontSize: 18), style: const TextStyle(color: Colors.black, fontSize: 18),
children: <TextSpan>[ children: <TextSpan>[
TextSpan( TextSpan(
text: 'https://unsplash.com/terms', text: 'https://unsplash.com/terms',
style: TextStyle( style: const TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.lightBlue), color: Colors.lightBlue),
recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
..onTap = () async { ..onTap = () async {
final url = 'https://unsplash.com/terms'; const url = 'https://unsplash.com/terms';
if (await url_launcher.canLaunch(url)) { if (await url_launcher.canLaunch(url)) {
await url_launcher.launch(url); await url_launcher.launch(url);
} }
@ -93,7 +93,7 @@ class PolicyDialog extends StatelessWidget {
}, },
child: Text( child: Text(
'CLOSE'.toUpperCase(), 'CLOSE'.toUpperCase(),
style: TextStyle(fontSize: 20), style: const TextStyle(fontSize: 20),
), ),
), ),
], ],

@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:meta/meta.dart';
import 'package:transparent_image/transparent_image.dart'; import 'package:transparent_image/transparent_image.dart';
import 'package:url_launcher/link.dart'; import 'package:url_launcher/link.dart';
@ -17,8 +16,8 @@ typedef PhotoDetailsPhotoSaveCallback = void Function(Photo);
class PhotoDetails extends StatefulWidget { class PhotoDetails extends StatefulWidget {
const PhotoDetails({ const PhotoDetails({
@required this.photo, required this.photo,
@required this.onPhotoSave, required this.onPhotoSave,
}); });
final Photo photo; final Photo photo;
final PhotoDetailsPhotoSaveCallback onPhotoSave; final PhotoDetailsPhotoSaveCallback onPhotoSave;
@ -32,21 +31,21 @@ class _PhotoDetailsState extends State<PhotoDetails>
Widget _buildPhotoAttribution(BuildContext context) { Widget _buildPhotoAttribution(BuildContext context) {
return Row( return Row(
children: [ children: [
Text('Photo by '), const Text('Photo by '),
Link( Link(
uri: Uri.parse( uri: Uri.parse(
'https://unsplash.com/@${widget.photo.user.username}?utm_source=$unsplashAppName&utm_medium=referral'), 'https://unsplash.com/@${widget.photo.user!.username}?utm_source=$unsplashAppName&utm_medium=referral'),
builder: (context, followLink) => TextButton( builder: (context, followLink) => TextButton(
onPressed: followLink, onPressed: followLink,
child: Text(widget.photo.user.name), child: Text(widget.photo.user!.name),
), ),
), ),
Text(' on '), const Text(' on '),
Link( Link(
uri: _unsplashHomepage, uri: _unsplashHomepage,
builder: (context, followLink) => TextButton( builder: (context, followLink) => TextButton(
onPressed: followLink, onPressed: followLink,
child: Text('Unsplash'), child: const Text('Unsplash'),
), ),
), ),
], ],
@ -65,22 +64,22 @@ class _PhotoDetailsState extends State<PhotoDetails>
const SizedBox(height: 16), const SizedBox(height: 16),
Card( Card(
shape: ContinuousRectangleBorder( shape: ContinuousRectangleBorder(
side: BorderSide(color: Colors.black12), side: const BorderSide(color: Colors.black12),
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
), ),
child: AnimatedSize( child: AnimatedSize(
vsync: this, vsync: this,
duration: Duration(milliseconds: 750), duration: const Duration(milliseconds: 750),
child: Padding( child: Padding(
padding: const EdgeInsets.fromLTRB(16, 16, 16, 40), padding: const EdgeInsets.fromLTRB(16, 16, 16, 40),
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: const BoxConstraints(
minWidth: 400, minWidth: 400,
minHeight: 400, minHeight: 400,
), ),
child: FadeInImage.memoryNetwork( child: FadeInImage.memoryNetwork(
placeholder: kTransparentImage, placeholder: kTransparentImage,
image: widget.photo.urls.small, image: widget.photo.urls!.small!,
), ),
), ),
), ),
@ -97,7 +96,7 @@ class _PhotoDetailsState extends State<PhotoDetails>
const SizedBox(width: 8), const SizedBox(width: 8),
IconButton( IconButton(
visualDensity: VisualDensity.compact, visualDensity: VisualDensity.compact,
icon: Icon(Icons.cloud_download), icon: const Icon(Icons.cloud_download),
onPressed: () => widget.onPhotoSave(widget.photo), onPressed: () => widget.onPhotoSave(widget.photo),
), ),
], ],

@ -24,15 +24,12 @@ import 'package:flutter/material.dart';
class Split extends StatefulWidget { class Split extends StatefulWidget {
/// Builds a split oriented along [axis]. /// Builds a split oriented along [axis].
const Split({ const Split({
Key key, Key? key,
@required this.axis, required this.axis,
@required this.firstChild, required this.firstChild,
@required this.secondChild, required this.secondChild,
double initialFirstFraction, double? initialFirstFraction,
}) : initialFirstFraction = initialFirstFraction ?? 0.5, }) : initialFirstFraction = initialFirstFraction ?? 0.5,
assert(axis != null),
assert(firstChild != null),
assert(secondChild != null),
super(key: key); super(key: key);
/// The main axis the children will lay out on. /// The main axis the children will lay out on.
@ -81,7 +78,7 @@ class Split extends StatefulWidget {
} }
class _SplitState extends State<Split> { class _SplitState extends State<Split> {
double firstFraction; late double firstFraction;
double get secondFraction => 1 - firstFraction; double get secondFraction => 1 - firstFraction;
@ -111,9 +108,8 @@ class _SplitState extends State<Split> {
var secondSize = axisSize * secondFraction; var secondSize = axisSize * secondFraction;
// Clamp the sizes to be sure there is enough space for the dividers. // Clamp the sizes to be sure there is enough space for the dividers.
firstSize = firstSize.clamp(halfDivider, axisSize - halfDivider) as double; firstSize = firstSize.clamp(halfDivider, axisSize - halfDivider);
secondSize = secondSize = secondSize.clamp(halfDivider, axisSize - halfDivider);
secondSize.clamp(halfDivider, axisSize - halfDivider) as double;
// Remove space from each child to place the divider in the middle. // Remove space from each child to place the divider in the middle.
firstSize = firstSize - halfDivider; firstSize = firstSize - halfDivider;
@ -126,7 +122,7 @@ class _SplitState extends State<Split> {
// Update the fraction of space consumed by the children, // Update the fraction of space consumed by the children,
// being sure not to allocate any negative space. // being sure not to allocate any negative space.
firstFraction += fractionalDelta; firstFraction += fractionalDelta;
firstFraction = firstFraction.clamp(0.0, 1.0) as double; firstFraction = firstFraction.clamp(0.0, 1.0);
}); });
} }

@ -31,4 +31,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
COCOAPODS: 1.10.0 COCOAPODS: 1.10.1

@ -7,28 +7,28 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "14.0.0" version: "22.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.41.2" version: "1.7.1"
ansicolor: ansicolor:
dependency: transitive dependency: transitive
description: description:
name: ansicolor name: ansicolor
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.1" version: "2.0.1"
args: args:
dependency: transitive dependency: transitive
description: description:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.0" version: "2.1.1"
async: async:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -49,42 +49,42 @@ packages:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.2" version: "2.0.2"
build_config: build_config:
dependency: transitive dependency: transitive
description: description:
name: build_config name: build_config
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.5" version: "1.0.0"
build_daemon: build_daemon:
dependency: transitive dependency: transitive
description: description:
name: build_daemon name: build_daemon
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.10" version: "3.0.0"
build_resolvers: build_resolvers:
dependency: transitive dependency: transitive
description: description:
name: build_resolvers name: build_resolvers
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.5.3" version: "2.0.3"
build_runner: build_runner:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.11.1" version: "2.0.4"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.7" version: "7.0.0"
built_collection: built_collection:
dependency: "direct main" dependency: "direct main"
description: description:
@ -98,14 +98,14 @@ packages:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.0.3" version: "8.0.6"
built_value_generator: built_value_generator:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: built_value_generator name: built_value_generator
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.0.3" version: "8.0.6"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -126,14 +126,14 @@ packages:
name: checked_yaml name: checked_yaml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "2.0.1"
cli_util: cli_util:
dependency: transitive dependency: transitive
description: description:
name: cli_util name: cli_util
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -147,7 +147,7 @@ packages:
name: code_builder name: code_builder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.7.0" version: "4.0.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -175,21 +175,21 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.2" version: "1.0.3"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
name: dart_style name: dart_style
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.12" version: "2.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -203,7 +203,7 @@ packages:
name: file name: file
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.2.1" version: "6.1.1"
file_selector: file_selector:
dependency: "direct main" dependency: "direct main"
description: description:
@ -258,13 +258,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_simple_treeview: flutter_simple_treeview:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_simple_treeview name: flutter_simple_treeview
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "3.0.0-nullsafety.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -275,41 +282,48 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
frontend_server_client:
dependency: transitive
description:
name: frontend_server_client
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
glob: glob:
dependency: transitive dependency: transitive
description: description:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "2.0.1"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
name: graphs name: graphs
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "2.0.0"
grinder: grinder:
dependency: "direct dev" dependency: "direct dev"
description: description:
name: grinder name: grinder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.8.6" version: "0.9.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.13.0" version: "0.13.3"
http_multi_server: http_multi_server:
dependency: transitive dependency: transitive
description: description:
name: http_multi_server name: http_multi_server
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.0" version: "3.0.1"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
@ -317,20 +331,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.0"
intl: injector:
dependency: transitive dependency: transitive
description: description:
name: intl name: injector
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "2.0.0"
io: io:
dependency: transitive dependency: transitive
description: description:
name: io name: io
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.3.5" version: "1.0.0"
js: js:
dependency: transitive dependency: transitive
description: description:
@ -344,14 +358,21 @@ packages:
name: json_annotation name: json_annotation
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.0" version: "4.0.1"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logging: logging:
dependency: "direct main" dependency: "direct main"
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.11.4" version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -364,7 +385,7 @@ packages:
description: description:
path: "plugins/menubar" path: "plugins/menubar"
ref: HEAD ref: HEAD
resolved-ref: "7812516a5c1fc8ef379e244106953a2b534432b9" resolved-ref: e48abe7c3e9ebfe0b81622167c5201d4e783bb81
url: "https://github.com/google/flutter-desktop-embedding.git" url: "https://github.com/google/flutter-desktop-embedding.git"
source: git source: git
version: "0.1.0" version: "0.1.0"
@ -388,7 +409,7 @@ packages:
name: msix name: msix
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.19" version: "2.1.2"
nested: nested:
dependency: transitive dependency: transitive
description: description:
@ -396,27 +417,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.1"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
name: package_config name: package_config
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "2.0.0"
path: path:
dependency: transitive dependency: transitive
description: description:
@ -425,7 +432,7 @@ packages:
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic: pedantic:
dependency: "direct main" dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -465,28 +472,28 @@ packages:
name: pubspec_parse name: pubspec_parse
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.8" version: "1.0.0"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
name: shelf name: shelf
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0" version: "1.1.4"
shelf_web_socket: shelf_web_socket:
dependency: transitive dependency: transitive
description: description:
name: shelf_web_socket name: shelf_web_socket
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.4+1" version: "1.0.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -498,7 +505,7 @@ packages:
name: source_gen name: source_gen
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.10+3" version: "1.0.1"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -554,7 +561,7 @@ packages:
name: timing name: timing
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.1+3" version: "1.0.0"
transparent_image: transparent_image:
dependency: "direct main" dependency: "direct main"
description: description:
@ -575,7 +582,7 @@ packages:
name: url_launcher name: url_launcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.0.2" version: "6.0.6"
url_launcher_linux: url_launcher_linux:
dependency: transitive dependency: transitive
description: description:
@ -596,14 +603,14 @@ packages:
name: url_launcher_platform_interface name: url_launcher_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.2" version: "2.0.3"
url_launcher_web: url_launcher_web:
dependency: transitive dependency: transitive
description: description:
name: url_launcher_web name: url_launcher_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
url_launcher_windows: url_launcher_windows:
dependency: transitive dependency: transitive
description: description:
@ -617,7 +624,7 @@ packages:
name: uuid name: uuid
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.1" version: "3.0.4"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
@ -638,14 +645,14 @@ packages:
name: web_socket_channel name: web_socket_channel
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "2.1.0"
yaml: yaml:
dependency: transitive dependency: transitive
description: description:
name: yaml name: yaml
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" version: "3.1.0"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.12.0 <3.0.0"
flutter: ">=2.0.0" flutter: ">=2.0.0"

@ -4,7 +4,7 @@ version: 1.0.0+1
publish_to: none publish_to: none
environment: environment:
sdk: ^2.11.0 sdk: '>=2.12.0 <3.0.0'
flutter: ^2.0.0 flutter: ^2.0.0
dependencies: dependencies:
@ -18,14 +18,13 @@ dependencies:
file_selector_macos: ^0.0.1 file_selector_macos: ^0.0.1
file_selector_windows: ^0.0.1 file_selector_windows: ^0.0.1
http: ^0.13.0 http: ^0.13.0
logging: ^0.11.3+2 logging: ^1.0.1
flutter_simple_treeview: ^2.0.1 flutter_simple_treeview: ^3.0.0-nullsafety.1
menubar: menubar:
git: git:
url: https://github.com/google/flutter-desktop-embedding.git url: https://github.com/google/flutter-desktop-embedding.git
path: plugins/menubar path: plugins/menubar
meta: ^1.1.8 meta: ^1.1.8
pedantic: ^1.9.0
provider: ^5.0.0 provider: ^5.0.0
transparent_image: ^2.0.0 transparent_image: ^2.0.0
uuid: ^3.0.1 uuid: ^3.0.1
@ -35,12 +34,13 @@ dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
async: ^2.4.0 async: ^2.4.0
build: ^1.2.2 build: ^2.0.2
build_runner: ^1.10.4 build_runner: ^2.0.4
built_value_generator: ^8.0.3 built_value_generator: ^8.0.3
grinder: ^0.8.3 grinder: ^0.9.0
msix: ^0.1.5 msix: ^2.1.2
source_gen: ^0.9.4 source_gen: ^1.0.1
flutter_lints: ^1.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true

@ -90,7 +90,7 @@ void main() {
} }
'''; ''';
final photo = Photo.fromJson(input); final photo = Photo.fromJson(input)!;
expect(photo.id, 'Dwu85P9SOIk'); expect(photo.id, 'Dwu85P9SOIk');
expect(photo.createdAt, '2016-05-03T11:00:28-04:00'); expect(photo.createdAt, '2016-05-03T11:00:28-04:00');
expect(photo.updatedAt, '2016-07-10T11:00:01-05:00'); expect(photo.updatedAt, '2016-07-10T11:00:01-05:00');
@ -99,12 +99,12 @@ void main() {
expect(photo.color, '#6E633A'); expect(photo.color, '#6E633A');
expect(photo.downloads, 1345); expect(photo.downloads, 1345);
expect(photo.likedByUser, false); expect(photo.likedByUser, false);
expect(photo.exif.make, 'Canon'); expect(photo.exif!.make, 'Canon');
expect(photo.exif.iso, 100); expect(photo.exif!.iso, 100);
expect(photo.location.city, 'Montreal'); expect(photo.location!.city, 'Montreal');
expect(photo.location.country, 'Canada'); expect(photo.location!.country, 'Canada');
expect(photo.location.position.latitude, 45.4732984); expect(photo.location!.position!.latitude, 45.4732984);
expect(photo.location.position.longitude, -73.6384879); expect(photo.location!.position!.longitude, -73.6384879);
}); });
test('User.fromJson', () { test('User.fromJson', () {
@ -149,7 +149,7 @@ void main() {
} }
'''; ''';
final user = User.fromJson(input); final user = User.fromJson(input)!;
expect(user.id, 'pXhwzz1JtQU'); expect(user.id, 'pXhwzz1JtQU');
}); });
@ -207,11 +207,11 @@ void main() {
} }
'''; ''';
final response = SearchPhotosResponse.fromJson(input); final response = SearchPhotosResponse.fromJson(input)!;
expect(response.total, 133); expect(response.total, 133);
expect(response.totalPages, 7); expect(response.totalPages, 7);
expect(response.results[0].id, 'eOLpJytrbsQ'); expect(response.results[0].id, 'eOLpJytrbsQ');
expect(response.results[0].user.id, 'Ul0QVz12Goo'); expect(response.results[0].user!.id, 'Ul0QVz12Goo');
}); });
group('Unsplash API client', () { group('Unsplash API client', () {
@ -283,12 +283,12 @@ void main() {
httpClient: httpClient, httpClient: httpClient,
); );
final response = await unsplashClient.searchPhotos(query: 'red'); final response = (await unsplashClient.searchPhotos(query: 'red'))!;
expect(response.total, 133); expect(response.total, 133);
expect(response.totalPages, 7); expect(response.totalPages, 7);
expect(response.results[0].id, 'eOLpJytrbsQ'); expect(response.results[0].id, 'eOLpJytrbsQ');
expect(response.results[0].user.id, 'Ul0QVz12Goo'); expect(response.results[0].user!.id, 'Ul0QVz12Goo');
}); });
test('handles failure', () async { test('handles failure', () async {
@ -525,12 +525,12 @@ void main() {
httpClient: httpClient, httpClient: httpClient,
); );
final response = await unsplashClient.searchPhotos(query: 'red'); final response = (await unsplashClient.searchPhotos(query: 'red'))!;
expect(response.total, 22395); expect(response.total, 22395);
expect(response.totalPages, 2240); expect(response.totalPages, 2240);
expect(response.results[0].id, 'E4u_Zo9PET8'); expect(response.results[0].id, 'E4u_Zo9PET8');
expect(response.results[0].user.id, '_2nQcPrbyuE'); expect(response.results[0].user!.id, '_2nQcPrbyuE');
expect(response.results[0].user.name, 'Sergiu Vălenaș'); expect(response.results[0].user!.name, 'Sergiu Vălenaș');
}); });
} }

@ -67,12 +67,12 @@ class FakeUnsplash implements Unsplash {
'''; ''';
@override @override
Future<SearchPhotosResponse> searchPhotos( Future<SearchPhotosResponse?> searchPhotos(
{String query, {String? query,
num page = 1, num page = 1,
num perPage = 10, num perPage = 10,
List<num> collections = const [], List<num> collections = const [],
SearchPhotosOrientation orientation}) async { SearchPhotosOrientation? orientation}) async {
return SearchPhotosResponse.fromJson(searchPhotosResponse); return SearchPhotosResponse.fromJson(searchPhotosResponse);
} }

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.11.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,14 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks package_api_docs: true
- constant_identifier_names package_prefixed_library_names: true
- control_flow_in_finally test_types_in_equals: true
- directives_ordering throw_in_finally: true
- empty_statements unnecessary_statements: true
- hash_and_equals use_key_in_widget_constructors: false
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -33,19 +33,19 @@ class _HomePageState extends State<HomePage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Federated Plugin Demo'), title: const Text('Federated Plugin Demo'),
), ),
body: Center( body: Center(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
batteryLevel == null batteryLevel == null
? SizedBox.shrink() ? const SizedBox.shrink()
: Text( : Text(
'Battery Level: $batteryLevel', 'Battery Level: $batteryLevel',
style: Theme.of(context).textTheme.headline5, style: Theme.of(context).textTheme.headline5,
), ),
SizedBox(height: 16), const SizedBox(height: 16),
ElevatedButton( ElevatedButton(
onPressed: () async { onPressed: () async {
try { try {
@ -64,7 +64,7 @@ class _HomePageState extends State<HomePage> {
); );
} }
}, },
child: Text('Get Battery Level'), child: const Text('Get Battery Level'),
), ),
], ],
), ),

@ -97,6 +97,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -114,6 +121,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -135,13 +149,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:

@ -1,7 +1,7 @@
name: federated_plugin_example name: federated_plugin_example
description: Demonstrates how to use the federated_plugin plugin. description: Demonstrates how to use the federated_plugin plugin.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: "none" # Remove this line if you wish to publish to pub.dev
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
@ -17,7 +17,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.11.0 flutter_lints: ^1.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true

@ -9,9 +9,9 @@ import 'package:flutter_test/flutter_test.dart';
void main() { void main() {
group('federated plugin demo tests', () { group('federated plugin demo tests', () {
final batteryLevel = 45; const batteryLevel = 45;
setUpAll(() { setUpAll(() {
MethodChannel('battery').setMockMethodCallHandler((call) async { const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') { if (call.method == 'getBatteryLevel') {
return batteryLevel; return batteryLevel;
} }

@ -83,6 +83,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -100,6 +107,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -121,13 +135,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:

@ -1,9 +1,8 @@
name: federated_plugin name: federated_plugin
description: A new flutter plugin project to demonstrate how to implement federated plugin. description: A new flutter plugin project to demonstrate how to implement federated plugin.
version: 0.0.1 version: 0.0.1
homepage:
publish_to: 'none' publish_to: "none"
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"
@ -24,7 +23,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.11.0 flutter_lints: ^1.0.0
flutter: flutter:
plugin: plugin:

@ -10,8 +10,8 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
group('Federated Plugin Test', () { group('Federated Plugin Test', () {
final batteryLevel = 34; const batteryLevel = 34;
MethodChannel('battery').setMockMethodCallHandler((call) async { const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') { if (call.method == 'getBatteryLevel') {
return batteryLevel; return batteryLevel;
} }

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.11.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,14 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks package_api_docs: true
- constant_identifier_names package_prefixed_library_names: true
- control_flow_in_finally test_types_in_equals: true
- directives_ordering throw_in_finally: true
- empty_statements unnecessary_statements: true
- hash_and_equals use_key_in_widget_constructors: false
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -7,7 +7,7 @@ packages:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -55,11 +55,25 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -81,13 +95,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic:
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: "direct main" dependency: "direct main"
description: description:
@ -141,7 +148,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

@ -17,4 +17,4 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
pedantic: ^1.11.0 flutter_lints: ^1.0.0

@ -10,8 +10,8 @@ void main() {
TestWidgetsFlutterBinding.ensureInitialized(); TestWidgetsFlutterBinding.ensureInitialized();
group('MethodChannel test', () { group('MethodChannel test', () {
final batteryLevel = 89; const batteryLevel = 89;
MethodChannel('battery').setMockMethodCallHandler((call) async { const MethodChannel('battery').setMockMethodCallHandler((call) async {
if (call.method == 'getBatteryLevel') { if (call.method == 'getBatteryLevel') {
return batteryLevel; return batteryLevel;
} }

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.11.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,14 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks package_api_docs: true
- constant_identifier_names package_prefixed_library_names: true
- control_flow_in_finally test_types_in_equals: true
- directives_ordering throw_in_finally: true
- empty_statements unnecessary_statements: true
- hash_and_equals use_key_in_widget_constructors: false
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared name: _fe_analyzer_shared
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "18.0.0" version: "22.0.0"
analyzer: analyzer:
dependency: transitive dependency: transitive
description: description:
name: analyzer name: analyzer
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.7.1"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -28,14 +28,14 @@ packages:
name: args name: args
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.1.1"
async: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0" version: "2.6.1"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@ -49,7 +49,7 @@ packages:
name: build name: build
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.2"
built_collection: built_collection:
dependency: transitive dependency: transitive
description: description:
@ -63,7 +63,7 @@ packages:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "8.0.3" version: "8.0.6"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -98,7 +98,7 @@ packages:
name: code_builder name: code_builder
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.7.0" version: "4.0.0"
collection: collection:
dependency: transitive dependency: transitive
description: description:
@ -119,14 +119,14 @@ packages:
name: crypto name: crypto
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.0" version: "3.0.1"
dart_style: dart_style:
dependency: transitive dependency: transitive
description: description:
name: dart_style name: dart_style
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.14" version: "2.0.1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
@ -165,6 +165,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -186,7 +193,7 @@ packages:
name: glob name: glob
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.1"
integration_test: integration_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -199,13 +206,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.6.3" version: "0.6.3"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
name: logging name: logging
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.0" version: "1.0.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
@ -226,7 +240,7 @@ packages:
name: mockito name: mockito
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "5.0.2" version: "5.0.9"
package_config: package_config:
dependency: transitive dependency: transitive
description: description:
@ -242,7 +256,7 @@ packages:
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
pedantic: pedantic:
dependency: "direct dev" dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
@ -268,7 +282,7 @@ packages:
name: process name: process
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.1.0" version: "4.2.1"
pub_semver: pub_semver:
dependency: transitive dependency: transitive
description: description:
@ -287,7 +301,7 @@ packages:
name: source_gen name: source_gen
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.10+4" version: "1.0.1"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -336,7 +350,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -357,7 +371,7 @@ packages:
name: vm_service name: vm_service
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "6.1.0+1" version: "6.2.0"
watcher: watcher:
dependency: transitive dependency: transitive
description: description:

@ -1,7 +1,6 @@
name: federated_plugin_web name: federated_plugin_web
description: Web implementation of federated_plugin to retrieve current battery level. description: Web implementation of federated_plugin to retrieve current battery level.
version: 0.0.1 version: 0.0.1
homepage:
publish_to: none publish_to: none
environment: environment:
@ -21,7 +20,7 @@ dev_dependencies:
sdk: flutter sdk: flutter
integration_test: integration_test:
sdk: flutter sdk: flutter
pedantic: ^1.11.0 flutter_lints: ^1.0.0
mockito: ^5.0.2 mockito: ^5.0.2
flutter: flutter:

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,16 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_print: false
- avoid_void_async avoid_types_on_closure_parameters: true
- await_only_futures avoid_void_async: true
- camel_case_types cancel_subscriptions: true
- cancel_subscriptions close_sinks: true
- close_sinks directives_ordering: true
- constant_identifier_names file_names: false
- control_flow_in_finally package_api_docs: true
- directives_ordering package_prefixed_library_names: true
- empty_statements test_types_in_equals: true
- hash_and_equals throw_in_finally: true
- implementation_imports unnecessary_statements: true
- non_constant_identifier_names use_key_in_widget_constructors: false
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -28,10 +28,8 @@ class FirebaseEntryApi implements EntryApi {
@override @override
Stream<List<Entry>> subscribe(String categoryId) { Stream<List<Entry>> subscribe(String categoryId) {
var snapshots = _categoriesRef var snapshots =
.document('$categoryId') _categoriesRef.document(categoryId).collection('entries').snapshots();
.collection('entries')
.snapshots();
var result = snapshots.map((querySnapshot) { var result = snapshots.map((querySnapshot) {
return querySnapshot.documents.map((snapshot) { return querySnapshot.documents.map((snapshot) {
return Entry.fromJson(snapshot.data)..id = snapshot.documentID; return Entry.fromJson(snapshot.data)..id = snapshot.documentID;
@ -54,7 +52,7 @@ class FirebaseEntryApi implements EntryApi {
@override @override
Future<Entry> insert(String categoryId, Entry entry) async { Future<Entry> insert(String categoryId, Entry entry) async {
var document = await _categoriesRef var document = await _categoriesRef
.document('$categoryId') .document(categoryId)
.collection('entries') .collection('entries')
.add(entry.toJson()); .add(entry.toJson());
return await get(categoryId, document.documentID); return await get(categoryId, document.documentID);
@ -62,8 +60,7 @@ class FirebaseEntryApi implements EntryApi {
@override @override
Future<List<Entry>> list(String categoryId) async { Future<List<Entry>> list(String categoryId) async {
var entriesRef = var entriesRef = _categoriesRef.document(categoryId).collection('entries');
_categoriesRef.document('$categoryId').collection('entries');
var querySnapshot = await entriesRef.getDocuments(); var querySnapshot = await entriesRef.getDocuments();
var entries = querySnapshot.documents var entries = querySnapshot.documents
.map((doc) => Entry.fromJson(doc.data)..id = doc.documentID) .map((doc) => Entry.fromJson(doc.data)..id = doc.documentID)
@ -110,7 +107,7 @@ class FirebaseCategoryApi implements CategoryApi {
@override @override
Future<Category> delete(String id) async { Future<Category> delete(String id) async {
var document = _categoriesRef.document('$id'); var document = _categoriesRef.document(id);
var categories = await get(document.documentID); var categories = await get(document.documentID);
await document.delete(); await document.delete();
@ -120,7 +117,7 @@ class FirebaseCategoryApi implements CategoryApi {
@override @override
Future<Category> get(String id) async { Future<Category> get(String id) async {
var document = _categoriesRef.document('$id'); var document = _categoriesRef.document(id);
var snapshot = await document.get(); var snapshot = await document.get();
return Category.fromJson(snapshot.data)..id = snapshot.documentID; return Category.fromJson(snapshot.data)..id = snapshot.documentID;
} }
@ -143,7 +140,7 @@ class FirebaseCategoryApi implements CategoryApi {
@override @override
Future<Category> update(Category category, String id) async { Future<Category> update(Category category, String id) async {
var document = _categoriesRef.document('$id'); var document = _categoriesRef.document(id);
await document.setData(category.toJson()); await document.setData(category.toJson());
var snapshot = await document.get(); var snapshot = await document.get();
return Category.fromJson(snapshot.data)..id = snapshot.documentID; return Category.fromJson(snapshot.data)..id = snapshot.documentID;

@ -20,11 +20,11 @@ class MockDashboardApi implements DashboardApi {
/// Creates a [MockDashboardApi] filled with mock data for the last 30 days. /// Creates a [MockDashboardApi] filled with mock data for the last 30 days.
Future<void> fillWithMockData() async { Future<void> fillWithMockData() async {
await Future<void>.delayed(Duration(seconds: 1)); await Future<void>.delayed(const Duration(seconds: 1));
var category1 = await categories.insert(Category('Coffee (oz)')); var category1 = await categories.insert(Category('Coffee (oz)'));
var category2 = await categories.insert(Category('Running (miles)')); var category2 = await categories.insert(Category('Running (miles)'));
var category3 = await categories.insert(Category('Git Commits')); var category3 = await categories.insert(Category('Git Commits'));
var monthAgo = DateTime.now().subtract(Duration(days: 30)); var monthAgo = DateTime.now().subtract(const Duration(days: 30));
for (var category in [category1, category2, category3]) { for (var category in [category1, category2, category3]) {
for (var i = 0; i < 30; i++) { for (var i = 0; i < 30; i++) {
@ -37,8 +37,8 @@ class MockDashboardApi implements DashboardApi {
} }
class MockCategoryApi implements CategoryApi { class MockCategoryApi implements CategoryApi {
Map<String, Category> _storage = {}; final Map<String, Category> _storage = {};
StreamController<List<Category>> _streamController = final StreamController<List<Category>> _streamController =
StreamController<List<Category>>.broadcast(); StreamController<List<Category>>.broadcast();
@override @override
@ -74,6 +74,7 @@ class MockCategoryApi implements CategoryApi {
return category..id = id; return category..id = id;
} }
@override
Stream<List<Category>> subscribe() => _streamController.stream; Stream<List<Category>> subscribe() => _streamController.stream;
void _emit() { void _emit() {
@ -82,8 +83,8 @@ class MockCategoryApi implements CategoryApi {
} }
class MockEntryApi implements EntryApi { class MockEntryApi implements EntryApi {
Map<String, Entry> _storage = {}; final Map<String, Entry> _storage = {};
StreamController<_EntriesEvent> _streamController = final StreamController<_EntriesEvent> _streamController =
StreamController.broadcast(); StreamController.broadcast();
@override @override

@ -26,14 +26,14 @@ class AppState {
/// Creates a [DashboardApi] for the given user. This allows users of this /// Creates a [DashboardApi] for the given user. This allows users of this
/// widget to specify whether [MockDashboardApi] or [ApiBuilder] should be /// widget to specify whether [MockDashboardApi] or [ApiBuilder] should be
/// created when the user logs in. /// created when the user logs in.
typedef DashboardApi ApiBuilder(User user); typedef ApiBuilder = DashboardApi Function(User user);
/// An app that displays a personalized dashboard. /// An app that displays a personalized dashboard.
class DashboardApp extends StatefulWidget { class DashboardApp extends StatefulWidget {
static ApiBuilder _mockApiBuilder = static DashboardApi _mockApiBuilder(User user) =>
(user) => MockDashboardApi()..fillWithMockData(); MockDashboardApi()..fillWithMockData();
static ApiBuilder _apiBuilder = static DashboardApi _apiBuilder(User user) =>
(user) => FirebaseDashboardApi(Firestore.instance, user.uid); FirebaseDashboardApi(Firestore.instance, user.uid);
final Auth auth; final Auth auth;
final ApiBuilder apiBuilder; final ApiBuilder apiBuilder;
@ -55,6 +55,7 @@ class DashboardApp extends StatefulWidget {
class _DashboardAppState extends State<DashboardApp> { class _DashboardAppState extends State<DashboardApp> {
AppState _appState; AppState _appState;
@override
void initState() { void initState() {
super.initState(); super.initState();
_appState = AppState(widget.auth); _appState = AppState(widget.auth);
@ -80,7 +81,7 @@ class SignInSwitcher extends StatefulWidget {
final AppState appState; final AppState appState;
final ApiBuilder apiBuilder; final ApiBuilder apiBuilder;
SignInSwitcher({ const SignInSwitcher({
this.appState, this.appState,
this.apiBuilder, this.apiBuilder,
}); });
@ -97,7 +98,7 @@ class _SignInSwitcherState extends State<SignInSwitcher> {
return AnimatedSwitcher( return AnimatedSwitcher(
switchInCurve: Curves.easeOut, switchInCurve: Curves.easeOut,
switchOutCurve: Curves.easeOut, switchOutCurve: Curves.easeOut,
duration: Duration(milliseconds: 200), duration: const Duration(milliseconds: 200),
child: _isSignedIn child: _isSignedIn
? HomePage( ? HomePage(
onSignOut: _handleSignOut, onSignOut: _handleSignOut,

@ -12,8 +12,10 @@ class FirebaseAuthService implements Auth {
final GoogleSignIn _googleSignIn = GoogleSignIn(); final GoogleSignIn _googleSignIn = GoogleSignIn();
final FirebaseAuth _auth = FirebaseAuth.instance; final FirebaseAuth _auth = FirebaseAuth.instance;
@override
Future<bool> get isSignedIn => _googleSignIn.isSignedIn(); Future<bool> get isSignedIn => _googleSignIn.isSignedIn();
@override
Future<User> signIn() async { Future<User> signIn() async {
try { try {
return await _signIn(); return await _signIn();
@ -41,6 +43,7 @@ class FirebaseAuthService implements Auth {
return _FirebaseUser(authResult.user.uid); return _FirebaseUser(authResult.user.uid);
} }
@override
Future<void> signOut() async { Future<void> signOut() async {
await Future.wait([ await Future.wait([
_auth.signOut(), _auth.signOut(),
@ -50,6 +53,7 @@ class FirebaseAuthService implements Auth {
} }
class _FirebaseUser implements User { class _FirebaseUser implements User {
@override
final String uid; final String uid;
_FirebaseUser(this.uid); _FirebaseUser(this.uid);

@ -7,6 +7,7 @@ import 'dart:math';
import 'auth.dart'; import 'auth.dart';
class MockAuthService implements Auth { class MockAuthService implements Auth {
@override
Future<bool> get isSignedIn async => false; Future<bool> get isSignedIn async => false;
@override @override
@ -26,5 +27,6 @@ class MockAuthService implements Auth {
} }
class MockUser implements User { class MockUser implements User {
@override
String get uid => "123"; String get uid => "123";
} }

@ -10,13 +10,14 @@ import '../app.dart';
import '../widgets/category_chart.dart'; import '../widgets/category_chart.dart';
class DashboardPage extends StatelessWidget { class DashboardPage extends StatelessWidget {
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var appState = Provider.of<AppState>(context); var appState = Provider.of<AppState>(context);
return FutureBuilder<List<Category>>( return FutureBuilder<List<Category>>(
future: appState.api.categories.list(), future: appState.api.categories.list(),
builder: (context, futureSnapshot) { builder: (context, futureSnapshot) {
if (!futureSnapshot.hasData) { if (!futureSnapshot.hasData) {
return Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); );
} }
@ -25,7 +26,7 @@ class DashboardPage extends StatelessWidget {
stream: appState.api.categories.subscribe(), stream: appState.api.categories.subscribe(),
builder: (context, snapshot) { builder: (context, snapshot) {
if (snapshot.data == null) { if (snapshot.data == null) {
return Center( return const Center(
child: CircularProgressIndicator(), child: CircularProgressIndicator(),
); );
} }
@ -40,14 +41,14 @@ class DashboardPage extends StatelessWidget {
class Dashboard extends StatelessWidget { class Dashboard extends StatelessWidget {
final List<Category> categories; final List<Category> categories;
Dashboard(this.categories); const Dashboard(this.categories);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var api = Provider.of<AppState>(context).api; var api = Provider.of<AppState>(context).api;
return Scrollbar( return Scrollbar(
child: GridView( child: GridView(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
childAspectRatio: 2, childAspectRatio: 2,
maxCrossAxisExtent: 500, maxCrossAxisExtent: 500,
), ),

@ -29,7 +29,7 @@ class _EntriesPageState extends State<EntriesPage> {
onSelected: (category) => setState(() => _selected = category)), onSelected: (category) => setState(() => _selected = category)),
Expanded( Expanded(
child: _selected == null child: _selected == null
? Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: EntriesList( : EntriesList(
category: _selected, category: _selected,
api: appState.api.entries, api: appState.api.entries,
@ -89,7 +89,7 @@ class _EntriesListState extends State<EntriesList> {
} }
Widget _buildLoadingIndicator() { Widget _buildLoadingIndicator() {
return Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
} }
@ -97,7 +97,7 @@ class EntryTile extends StatelessWidget {
final Category category; final Category category;
final Entry entry; final Entry entry;
EntryTile({ const EntryTile({
this.category, this.category,
this.entry, this.entry,
}); });
@ -111,7 +111,7 @@ class EntryTile extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
TextButton( TextButton(
child: Text('Edit'), child: const Text('Edit'),
onPressed: () { onPressed: () {
showDialog<void>( showDialog<void>(
context: context, context: context,
@ -122,19 +122,19 @@ class EntryTile extends StatelessWidget {
}, },
), ),
TextButton( TextButton(
child: Text('Delete'), child: const Text('Delete'),
onPressed: () async { onPressed: () async {
var shouldDelete = await showDialog<bool>( var shouldDelete = await showDialog<bool>(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: Text('Delete entry?'), title: const Text('Delete entry?'),
actions: [ actions: [
TextButton( TextButton(
child: Text('Cancel'), child: const Text('Cancel'),
onPressed: () => Navigator.of(context).pop(false), onPressed: () => Navigator.of(context).pop(false),
), ),
TextButton( TextButton(
child: Text('Delete'), child: const Text('Delete'),
onPressed: () => Navigator.of(context).pop(true), onPressed: () => Navigator.of(context).pop(true),
), ),
], ],
@ -147,7 +147,7 @@ class EntryTile extends StatelessWidget {
.delete(category.id, entry.id); .delete(category.id, entry.id);
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( const SnackBar(
content: Text('Entry deleted'), content: Text('Entry deleted'),
), ),
); );

@ -12,7 +12,7 @@ import 'entries.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
final VoidCallback onSignOut; final VoidCallback onSignOut;
HomePage({ const HomePage({
@required this.onSignOut, @required this.onSignOut,
}); });
@ -26,19 +26,19 @@ class _HomePageState extends State<HomePage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AdaptiveScaffold( return AdaptiveScaffold(
title: Text('Dashboard App'), title: const Text('Dashboard App'),
actions: [ actions: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextButton( child: TextButton(
style: TextButton.styleFrom(primary: Colors.white), style: TextButton.styleFrom(primary: Colors.white),
onPressed: () => _handleSignOut(), onPressed: () => _handleSignOut(),
child: Text('Sign Out'), child: const Text('Sign Out'),
), ),
) )
], ],
currentIndex: _pageIndex, currentIndex: _pageIndex,
destinations: [ destinations: const [
AdaptiveScaffoldDestination(title: 'Home', icon: Icons.home), AdaptiveScaffoldDestination(title: 'Home', icon: Icons.home),
AdaptiveScaffoldDestination(title: 'Entries', icon: Icons.list), AdaptiveScaffoldDestination(title: 'Entries', icon: Icons.list),
AdaptiveScaffoldDestination(title: 'Settings', icon: Icons.settings), AdaptiveScaffoldDestination(title: 'Settings', icon: Icons.settings),
@ -61,7 +61,7 @@ class _HomePageState extends State<HomePage> {
FloatingActionButton _buildFab(BuildContext context) { FloatingActionButton _buildFab(BuildContext context) {
return FloatingActionButton( return FloatingActionButton(
child: Icon(Icons.add), child: const Icon(Icons.add),
onPressed: () => _handleFabPressed(), onPressed: () => _handleFabPressed(),
); );
} }
@ -88,16 +88,16 @@ class _HomePageState extends State<HomePage> {
var shouldSignOut = await showDialog<bool>( var shouldSignOut = await showDialog<bool>(
context: context, context: context,
builder: (context) => AlertDialog( builder: (context) => AlertDialog(
title: Text('Are you sure you want to sign out?'), title: const Text('Are you sure you want to sign out?'),
actions: [ actions: [
TextButton( TextButton(
child: Text('No'), child: const Text('No'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(false); Navigator.of(context).pop(false);
}, },
), ),
TextButton( TextButton(
child: Text('Yes'), child: const Text('Yes'),
onPressed: () { onPressed: () {
Navigator.of(context).pop(true); Navigator.of(context).pop(true);
}, },
@ -122,6 +122,6 @@ class _HomePageState extends State<HomePage> {
return EntriesPage(); return EntriesPage();
} }
return Center(child: Text('Settings page')); return const Center(child: Text('Settings page'));
} }
} }

@ -10,7 +10,7 @@ class SignInPage extends StatelessWidget {
final Auth auth; final Auth auth;
final ValueChanged<User> onSuccess; final ValueChanged<User> onSuccess;
SignInPage({ const SignInPage({
@required this.auth, @required this.auth,
@required this.onSuccess, @required this.onSuccess,
}); });
@ -29,7 +29,7 @@ class SignInButton extends StatefulWidget {
final Auth auth; final Auth auth;
final ValueChanged<User> onSuccess; final ValueChanged<User> onSuccess;
SignInButton({ const SignInButton({
@required this.auth, @required this.auth,
@required this.onSuccess, @required this.onSuccess,
}); });
@ -78,7 +78,7 @@ class _SignInButtonState extends State<SignInButton> {
var alreadySignedIn = snapshot.data; var alreadySignedIn = snapshot.data;
if (snapshot.connectionState != ConnectionState.done || if (snapshot.connectionState != ConnectionState.done ||
alreadySignedIn == true) { alreadySignedIn == true) {
return CircularProgressIndicator(); return const CircularProgressIndicator();
} }
// If sign in failed, show toast and the login button // If sign in failed, show toast and the login button
@ -87,7 +87,7 @@ class _SignInButtonState extends State<SignInButton> {
} }
return ElevatedButton( return ElevatedButton(
child: Text('Sign In with Google'), child: const Text('Sign In with Google'),
onPressed: () => _signIn(), onPressed: () => _signIn(),
); );
}, },
@ -96,7 +96,7 @@ class _SignInButtonState extends State<SignInButton> {
void _showError() { void _showError() {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
SnackBar( const SnackBar(
content: Text('Unable to sign in.'), content: Text('Unable to sign in.'),
), ),
); );

@ -60,6 +60,6 @@ Iterable<List<Entry>> _entriesInRangeImpl(
} }
yield es; yield es;
d = d.add(Duration(days: 1)); d = d.add(const Duration(days: 1));
} }
} }

@ -10,6 +10,6 @@ extension DayUtils on DateTime {
/// Checks that the two [DateTime]s share the same date. /// Checks that the two [DateTime]s share the same date.
bool isSameDay(DateTime d2) { bool isSameDay(DateTime d2) {
return this.year == d2.year && this.month == d2.month && this.day == d2.day; return year == d2.year && month == d2.month && day == d2.day;
} }
} }

@ -13,7 +13,7 @@ class CategoryDropdown extends StatefulWidget {
final CategoryApi api; final CategoryApi api;
final ValueChanged<Category> onSelected; final ValueChanged<Category> onSelected;
CategoryDropdown({ const CategoryDropdown({
@required this.api, @required this.api,
@required this.onSelected, @required this.onSelected,
}); });
@ -27,6 +27,7 @@ class _CategoryDropdownState extends State<CategoryDropdown> {
Future<List<Category>> _future; Future<List<Category>> _future;
Stream<List<Category>> _stream; Stream<List<Category>> _stream;
@override
void initState() { void initState() {
super.initState(); super.initState();
@ -69,7 +70,7 @@ class _CategoryDropdownState extends State<CategoryDropdown> {
builder: (context, futureSnapshot) { builder: (context, futureSnapshot) {
// Show an empty dropdown while the data is loading. // Show an empty dropdown while the data is loading.
if (!futureSnapshot.hasData) { if (!futureSnapshot.hasData) {
return DropdownButton<Category>(items: [], onChanged: null); return DropdownButton<Category>(items: const [], onChanged: null);
} }
return StreamBuilder<List<Category>>( return StreamBuilder<List<Category>>(

@ -18,11 +18,12 @@ class CategoryChart extends StatelessWidget {
final Category category; final Category category;
final DashboardApi api; final DashboardApi api;
CategoryChart({ const CategoryChart({
@required this.category, @required this.category,
@required this.api, @required this.api,
}); });
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return Column(
children: [ children: [
@ -33,7 +34,7 @@ class CategoryChart extends StatelessWidget {
children: [ children: [
Text(category.name), Text(category.name),
IconButton( IconButton(
icon: Icon(Icons.settings), icon: const Icon(Icons.settings),
onPressed: () { onPressed: () {
showDialog<EditCategoryDialog>( showDialog<EditCategoryDialog>(
context: context, context: context,
@ -73,14 +74,14 @@ class CategoryChart extends StatelessWidget {
} }
Widget _buildLoadingIndicator() { Widget _buildLoadingIndicator() {
return Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
} }
class _BarChart extends StatelessWidget { class _BarChart extends StatelessWidget {
final List<Entry> entries; final List<Entry> entries;
_BarChart({this.entries}); const _BarChart({this.entries});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

@ -13,7 +13,7 @@ class NewCategoryForm extends StatefulWidget {
} }
class _NewCategoryFormState extends State<NewCategoryForm> { class _NewCategoryFormState extends State<NewCategoryForm> {
Category _category = Category(''); final Category _category = Category('');
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -34,7 +34,7 @@ class EditCategoryForm extends StatefulWidget {
final Category category; final Category category;
final ValueChanged<bool> onDone; final ValueChanged<bool> onDone;
EditCategoryForm({ const EditCategoryForm({
@required this.category, @required this.category,
@required this.onDone, @required this.onDone,
}); });
@ -57,7 +57,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: TextFormField( child: TextFormField(
initialValue: widget.category.name, initialValue: widget.category.name,
decoration: InputDecoration( decoration: const InputDecoration(
labelText: 'Name', labelText: 'Name',
), ),
onChanged: (newValue) { onChanged: (newValue) {
@ -77,7 +77,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ElevatedButton( child: ElevatedButton(
child: Text('Cancel'), child: const Text('Cancel'),
onPressed: () { onPressed: () {
widget.onDone(false); widget.onDone(false);
}, },
@ -86,7 +86,7 @@ class _EditCategoryFormState extends State<EditCategoryForm> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ElevatedButton( child: ElevatedButton(
child: Text('OK'), child: const Text('OK'),
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
widget.onDone(true); widget.onDone(true);

@ -14,7 +14,7 @@ class NewCategoryDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return SimpleDialog(
title: Text('New Category'), title: const Text('New Category'),
children: <Widget>[ children: <Widget>[
NewCategoryForm(), NewCategoryForm(),
], ],
@ -25,7 +25,7 @@ class NewCategoryDialog extends StatelessWidget {
class EditCategoryDialog extends StatelessWidget { class EditCategoryDialog extends StatelessWidget {
final Category category; final Category category;
EditCategoryDialog({ const EditCategoryDialog({
@required this.category, @required this.category,
}); });
@ -34,7 +34,7 @@ class EditCategoryDialog extends StatelessWidget {
var api = Provider.of<AppState>(context).api; var api = Provider.of<AppState>(context).api;
return SimpleDialog( return SimpleDialog(
title: Text('Edit Category'), title: const Text('Edit Category'),
children: [ children: [
EditCategoryForm( EditCategoryForm(
category: category, category: category,
@ -59,7 +59,7 @@ class _NewEntryDialogState extends State<NewEntryDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return SimpleDialog(
title: Text('New Entry'), title: const Text('New Entry'),
children: [ children: [
NewEntryForm(), NewEntryForm(),
], ],
@ -71,7 +71,7 @@ class EditEntryDialog extends StatelessWidget {
final Category category; final Category category;
final Entry entry; final Entry entry;
EditEntryDialog({ const EditEntryDialog({
this.category, this.category,
this.entry, this.entry,
}); });
@ -81,7 +81,7 @@ class EditEntryDialog extends StatelessWidget {
var api = Provider.of<AppState>(context).api; var api = Provider.of<AppState>(context).api;
return SimpleDialog( return SimpleDialog(
title: Text('Edit Entry'), title: const Text('Edit Entry'),
children: [ children: [
EditEntryForm( EditEntryForm(
entry: entry, entry: entry,

@ -17,7 +17,7 @@ class NewEntryForm extends StatefulWidget {
class _NewEntryFormState extends State<NewEntryForm> { class _NewEntryFormState extends State<NewEntryForm> {
Category _selected; Category _selected;
Entry _entry = Entry(0, DateTime.now()); final Entry _entry = Entry(0, DateTime.now());
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -55,7 +55,7 @@ class EditEntryForm extends StatefulWidget {
final Entry entry; final Entry entry;
final ValueChanged<bool> onDone; final ValueChanged<bool> onDone;
EditEntryForm({ const EditEntryForm({
@required this.entry, @required this.entry,
@required this.onDone, @required this.onDone,
}); });
@ -75,10 +75,10 @@ class _EditEntryFormState extends State<EditEntryForm> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Padding( Padding(
padding: EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: TextFormField( child: TextFormField(
initialValue: widget.entry.value.toString(), initialValue: widget.entry.value.toString(),
decoration: InputDecoration(labelText: 'Value'), decoration: const InputDecoration(labelText: 'Value'),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
validator: (value) { validator: (value) {
try { try {
@ -98,18 +98,19 @@ class _EditEntryFormState extends State<EditEntryForm> {
), ),
), ),
Padding( Padding(
padding: EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(intl.DateFormat('MM/dd/yyyy').format(widget.entry.time)), Text(intl.DateFormat('MM/dd/yyyy').format(widget.entry.time)),
ElevatedButton( ElevatedButton(
child: Text('Edit'), child: const Text('Edit'),
onPressed: () async { onPressed: () async {
var result = await showDatePicker( var result = await showDatePicker(
context: context, context: context,
initialDate: widget.entry.time, initialDate: widget.entry.time,
firstDate: DateTime.now().subtract(Duration(days: 365)), firstDate:
DateTime.now().subtract(const Duration(days: 365)),
lastDate: DateTime.now()); lastDate: DateTime.now());
if (result == null) { if (result == null) {
return; return;
@ -128,7 +129,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ElevatedButton( child: ElevatedButton(
child: Text('Cancel'), child: const Text('Cancel'),
onPressed: () { onPressed: () {
widget.onDone(false); widget.onDone(false);
}, },
@ -137,7 +138,7 @@ class _EditEntryFormState extends State<EditEntryForm> {
Padding( Padding(
padding: const EdgeInsets.only(left: 8.0, right: 8.0), padding: const EdgeInsets.only(left: 8.0, right: 8.0),
child: ElevatedButton( child: ElevatedButton(
child: Text('OK'), child: const Text('OK'),
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState.validate()) {
widget.onDone(true); widget.onDone(true);

@ -35,7 +35,7 @@ class AdaptiveScaffold extends StatefulWidget {
final ValueChanged<int> onNavigationIndexChange; final ValueChanged<int> onNavigationIndexChange;
final FloatingActionButton floatingActionButton; final FloatingActionButton floatingActionButton;
AdaptiveScaffold({ const AdaptiveScaffold({
this.title, this.title,
this.body, this.body,
this.actions = const [], this.actions = const [],

@ -84,14 +84,14 @@ packages:
name: built_collection name: built_collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.3.2" version: "5.0.0"
built_value: built_value:
dependency: transitive dependency: transitive
description: description:
name: built_value name: built_value
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "7.1.0" version: "8.0.6"
characters: characters:
dependency: transitive dependency: transitive
description: description:
@ -133,7 +133,7 @@ packages:
name: cli_util name: cli_util
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.0" version: "0.3.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -252,14 +252,14 @@ packages:
name: firebase_core name: firebase_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.5" version: "0.4.4"
firebase_core_platform_interface: firebase_core_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: firebase_core_platform_interface name: firebase_core_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.4" version: "1.0.0"
firebase_core_web: firebase_core_web:
dependency: transitive dependency: transitive
description: description:
@ -273,12 +273,19 @@ packages:
name: fixnum name: fixnum
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.10.11" version: "1.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@ -302,21 +309,21 @@ packages:
name: google_sign_in name: google_sign_in
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.5.9" version: "5.0.4"
google_sign_in_platform_interface: google_sign_in_platform_interface:
dependency: transitive dependency: transitive
description: description:
name: google_sign_in_platform_interface name: google_sign_in_platform_interface
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.2" version: "2.0.1"
google_sign_in_web: google_sign_in_web:
dependency: transitive dependency: transitive
description: description:
name: google_sign_in_web name: google_sign_in_web
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.2" version: "0.10.0"
graphs: graphs:
dependency: transitive dependency: transitive
description: description:
@ -387,6 +394,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.5.1" version: "3.5.1"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
logging: logging:
dependency: transitive dependency: transitive
description: description:
@ -456,7 +470,7 @@ packages:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.3" version: "1.11.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -498,7 +512,14 @@ packages:
name: quiver name: quiver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.5" version: "3.0.1"
quiver_hashcode:
dependency: transitive
description:
name: quiver_hashcode
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
shelf: shelf:
dependency: transitive dependency: transitive
description: description:
@ -524,7 +545,7 @@ packages:
name: source_gen name: source_gen
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.9.10+1" version: "0.9.10+3"
source_span: source_span:
dependency: transitive dependency: transitive
description: description:
@ -625,4 +646,4 @@ packages:
version: "2.2.1" version: "2.2.1"
sdks: sdks:
dart: ">=2.12.0 <3.0.0" dart: ">=2.12.0 <3.0.0"
flutter: ">=1.16.0" flutter: ">=1.20.0"

@ -10,7 +10,7 @@ dependencies:
cupertino_icons: ^0.1.2 cupertino_icons: ^0.1.2
firebase_auth: ^0.16.1 firebase_auth: ^0.16.1
firebase_core: ^0.4.3 firebase_core: ^0.4.3
google_sign_in: ^4.4 0 google_sign_in: ^5.0.0
json_annotation: ^3.0.0 json_annotation: ^3.0.0
provider: ^4.0.0 provider: ^4.0.0
uuid: ^2.0.0 uuid: ^2.0.0
@ -21,5 +21,6 @@ dev_dependencies:
build_runner: ^1.8.0 build_runner: ^1.8.0
json_serializable: ^3.3.0 json_serializable: ^3.3.0
grinder: ^0.8.4 grinder: ^0.8.4
flutter_lints: ^1.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true

@ -95,7 +95,7 @@ Stream<File> _filesWithoutCopyright() async* {
var firstThreeLines = await file var firstThreeLines = await file
.openRead() .openRead()
.transform(utf8.decoder) .transform(utf8.decoder)
.transform(LineSplitter()) .transform(const LineSplitter())
.take(3) .take(3)
.fold<String>('', (previous, element) { .fold<String>('', (previous, element) {
if (previous == '') return element; if (previous == '') return element;

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.9.0.yaml include: package:flutter_lints/flutter.yaml
analyzer: analyzer:
strong-mode: strong-mode:
@ -7,25 +7,14 @@ analyzer:
linter: linter:
rules: rules:
- avoid_types_on_closure_parameters avoid_types_on_closure_parameters: true
- avoid_void_async avoid_void_async: true
- await_only_futures cancel_subscriptions: true
- camel_case_types close_sinks: true
- cancel_subscriptions directives_ordering: true
- close_sinks package_api_docs: true
- constant_identifier_names package_prefixed_library_names: true
- control_flow_in_finally test_types_in_equals: true
- directives_ordering throw_in_finally: true
- empty_statements unnecessary_statements: true
- hash_and_equals use_key_in_widget_constructors: false
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -76,7 +76,7 @@ class _HomePageState extends State<HomePage> {
return Center(child: Text('Error: ${snapshot.error}')); return Center(child: Text('Error: ${snapshot.error}'));
} }
if (!snapshot.hasData) { if (!snapshot.hasData) {
return Center(child: const Text('Loading...')); return const Center(child: Text('Loading...'));
} }
return Stack( return Stack(
@ -211,7 +211,7 @@ class _StoreListTileState extends State<StoreListTile> {
return ListTile( return ListTile(
title: Text(widget.document['name'] as String), title: Text(widget.document['name'] as String),
subtitle: Text(widget.document['address'] as String), subtitle: Text(widget.document['address'] as String),
leading: Container( leading: SizedBox(
width: 100, width: 100,
height: 100, height: 100,
child: _placePhotoUrl.isNotEmpty child: _placePhotoUrl.isNotEmpty

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save