Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Specifying return type of get<T> as T instead of dynamic #310

Merged
merged 2 commits into from
Feb 19, 2020
Merged

Specifying return type of get<T> as T instead of dynamic #310

merged 2 commits into from
Feb 19, 2020

Conversation

PawlikMichal25
Copy link
Contributor

Small change, but I think it's a good practice to return a concrete type instead of dynamic when we can.

Additionally, for developers who have implicit-casts set to false in their analysys_options.yaml, from this point on they won't have to write code like this:
String name = get<String>('name') as String;
but instead will be able to do just:
String name = get<String>('name');

Thanks for making this package btw! :)

th3brink and others added 2 commits February 15, 2020 19:08
* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>
@phillwiggins
Copy link
Member

Hey @BaranMichal25

Great suggestion. Have you tried and testing this in anger?

Quick one, are you able to close this MR and create a new MR pointing to branch labelled "release/1.0.26"? I will merge it there, give it some testing too!

Cheers

@PawlikMichal25 PawlikMichal25 changed the base branch from master to release/1.0.26 February 19, 2020 08:26
@PawlikMichal25
Copy link
Contributor Author

Hey @phillwiggins

I changed here the target branch to release/1.0.26.
I also tested it in our app (multiple tables, requests, mappers) and everything works fine 👍

@phillwiggins phillwiggins merged commit 699778d into parse-community:release/1.0.26 Feb 19, 2020
@phillwiggins
Copy link
Member

Excellent, good effort!

phillwiggins added a commit that referenced this pull request Mar 28, 2020
* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (#301)

* Added an example of how to update existing object values (#309)

* Fixed the Parse().initialize's return value (#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Added example for update existing Object values

Maybe need some correction. Thank you.

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Specifying return type of get<T> as T instead of dynamic (#310)

* Fixed the Parse().initialize's return value (#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Specified T return type instead of dynamic for get<T> method

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Live query connection stream (#314)

* Fixed the Parse().initialize's return value (#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* added live-query-client-event-stream

* Update parse_live_query.dart

* Cleanup

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Livequery reconnecting controller (#316)

* Fix: reconnecting

Done as in #315 (comment) described.

* Changed type of Future

Done as described in fischerscode@805e830#r37587405.

* Revert "Changed type of Future"

This reverts commit fecee76.

* adding LiveQueryReconnectingController

This is a solution for #315 (comment)

How it works:
- Only the LiveQueryReconnectingController handles reconnecting after a connection loss.
- LiveQueryReconnectingController holds informations:
  1. connection state of the device
  2. did the user disconnected from the server
  3. is currently a connection to the server estalished
- LiveQueryReconnectingController tries to reconnect after preset timespans.

* cleanup

* remove _userDisconnected from Client

This is not needed any more.
Keeping track of this information is now done by LiveQueryReconnectingController.

* subscribe(query) modified

Wait until client is connected to live-query-server.

Fixes fischerscode@d058eb0#r37612749

* Parsequery OR (#317)

* Start adding or

First idea for #213

Works with normal Query and LiveQuery.

Missing:
- any kind of "UserError handling"
- further testing

* Update parse_query.dart

* Fix for Sembast-API change (#322)

See: #321 (comment)

* added QueryBuilder.copy(QueryBuilder<T> query) (#320)

* added QueryBuilder.copy(QueryBuilder<T> query)

Added a implementation to create a new QueryBuilder based on an old one.
This is a deep copy.
Tested only with basic queries.

* added QueryBuilder.copy(QueryBuilder<T> query)

Added a implementation to create a new QueryBuilder based on an old one.
This is a deep copy.
Tested only with basic queries.

* ParseLiveList (#324)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* added ParseACL to parseEncode (#326)

As described in #325 (comment).

Should Fix #325

* ParseLiveList Performance improvement (#327)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* LiveList - Performance Improvement

This is the change mentioned in #324 (comment)

Requires #326

* LiveList - Performance Improvement

This is the change mentioned in #324 (comment)

Requires #326

* example_livelist: use clientKey

* Changed example_livelist query

In the README I wrote, you can use a field called "show" to hide elements.

* ParseLiveListElementSnapshot added (#329)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* LiveList - Performance Improvement

This is the change mentioned in #324 (comment)

Requires #326

* LiveList - Performance Improvement

This is the change mentioned in #324 (comment)

Requires #326

* example_livelist: use clientKey

* Changed example_livelist query

In the README I wrote, you can use a field called "show" to hide elements.

* Remove: RemovedItemBuilder

duplicade to ChildBuilder

* removed firstBuild

* ParseLiveListElementSnapshot added

* Clear unsaved changes (#331)

* added clearUnsavedChanges

An idea for #318

* moved clearUnsavedChanges to ParseBase

* LiveQueryController: connect at init (#332)

Should fix #330

* LiveList: fixed defaultBuilder (#333)

* Added generics to Query/LiveQuery (#336)

* LiveQuery: fixes list is null (#334)

* Fix: #341 (#342)

It seems like `subscription.on(LiveQueryEvent.update` reuses a existing object.

* Updating LiveQuery for web (#340)

* LiveQuery: fixes list is null

* Updating LiveQuery for web

parse_live_query_web was outdated compared to parse_live_query.

Note: parse_live_query was copied and fixed again for this change.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>

* Release/1.0.26 - Code formatting, remove lint issues

Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>
Co-authored-by: L. Rommy Arbantas <arbantas@gmail.com>
Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Michal Baran <baranmichal25@gmail.com>
Co-authored-by: Maximilian Fischer <45403027+maaeps@users.noreply.github.com>
fischerscode added a commit to fischerscode/Parse-SDK-Flutter that referenced this pull request Sep 5, 2020
* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (parse-community#301)

* Added an example of how to update existing object values (parse-community#309)

* Fixed the Parse().initialize's return value (parse-community#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (parse-community#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Added example for update existing Object values

Maybe need some correction. Thank you.

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Specifying return type of get<T> as T instead of dynamic (parse-community#310)

* Fixed the Parse().initialize's return value (parse-community#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (parse-community#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Specified T return type instead of dynamic for get<T> method

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Live query connection stream (parse-community#314)

* Fixed the Parse().initialize's return value (parse-community#307)

* Release/1.0.26 - Update docs

* Updated Live Queries related documentation (parse-community#301)

* Fixed the parse initialize method

Parse().initialize returns a new instantiation of the Parse class, but it should return the initialized instance.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* added live-query-client-event-stream

* Update parse_live_query.dart

* Cleanup

Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>
Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>

* Livequery reconnecting controller (parse-community#316)

* Fix: reconnecting

Done as in parse-community#315 (comment) described.

* Changed type of Future

Done as described in 805e830#r37587405.

* Revert "Changed type of Future"

This reverts commit fecee76.

* adding LiveQueryReconnectingController

This is a solution for parse-community#315 (comment)

How it works:
- Only the LiveQueryReconnectingController handles reconnecting after a connection loss.
- LiveQueryReconnectingController holds informations:
  1. connection state of the device
  2. did the user disconnected from the server
  3. is currently a connection to the server estalished
- LiveQueryReconnectingController tries to reconnect after preset timespans.

* cleanup

* remove _userDisconnected from Client

This is not needed any more.
Keeping track of this information is now done by LiveQueryReconnectingController.

* subscribe(query) modified

Wait until client is connected to live-query-server.

Fixes d058eb0#r37612749

* Parsequery OR (parse-community#317)

* Start adding or

First idea for parse-community#213

Works with normal Query and LiveQuery.

Missing:
- any kind of "UserError handling"
- further testing

* Update parse_query.dart

* Fix for Sembast-API change (parse-community#322)

See: parse-community#321 (comment)

* added QueryBuilder.copy(QueryBuilder<T> query) (parse-community#320)

* added QueryBuilder.copy(QueryBuilder<T> query)

Added a implementation to create a new QueryBuilder based on an old one.
This is a deep copy.
Tested only with basic queries.

* added QueryBuilder.copy(QueryBuilder<T> query)

Added a implementation to create a new QueryBuilder based on an old one.
This is a deep copy.
Tested only with basic queries.

* ParseLiveList (parse-community#324)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* added ParseACL to parseEncode (parse-community#326)

As described in parse-community#325 (comment).

Should Fix parse-community#325

* ParseLiveList Performance improvement (parse-community#327)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* LiveList - Performance Improvement

This is the change mentioned in parse-community#324 (comment)

Requires parse-community#326

* LiveList - Performance Improvement

This is the change mentioned in parse-community#324 (comment)

Requires parse-community#326

* example_livelist: use clientKey

* Changed example_livelist query

In the README I wrote, you can use a field called "show" to hide elements.

* ParseLiveListElementSnapshot added (parse-community#329)

* Created ParseLiveList

* LiveList & LivListBuilder works

* Cleanup

* changed to animated list

* Fix in dataloading

* updated AnimatedList

* Finished Animations & cleanup

* handle reconnect

* Added dispose methodes & renamed classes & cleanup

* cleanup

* Fix animation duration

* added README ParseLiveList section

* Initialized example_livelist

* Update application_constants.dart

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 4d8982d.

* Update .gitignore

* HotFix: object Update from client

If the client changes the object.
(ParseObject does not get copied)

* Implemented simple example

* Update README.md

* Update main.dart

* Update README.md

* Update README.md

* LiveList - Performance Improvement

This is the change mentioned in parse-community#324 (comment)

Requires parse-community#326

* LiveList - Performance Improvement

This is the change mentioned in parse-community#324 (comment)

Requires parse-community#326

* example_livelist: use clientKey

* Changed example_livelist query

In the README I wrote, you can use a field called "show" to hide elements.

* Remove: RemovedItemBuilder

duplicade to ChildBuilder

* removed firstBuild

* ParseLiveListElementSnapshot added

* Clear unsaved changes (parse-community#331)

* added clearUnsavedChanges

An idea for parse-community#318

* moved clearUnsavedChanges to ParseBase

* LiveQueryController: connect at init (parse-community#332)

Should fix parse-community#330

* LiveList: fixed defaultBuilder (parse-community#333)

* Added generics to Query/LiveQuery (parse-community#336)

* LiveQuery: fixes list is null (parse-community#334)

* Fix: parse-community#341 (parse-community#342)

It seems like `subscription.on(LiveQueryEvent.update` reuses a existing object.

* Updating LiveQuery for web (parse-community#340)

* LiveQuery: fixes list is null

* Updating LiveQuery for web

parse_live_query_web was outdated compared to parse_live_query.

Note: parse_live_query was copied and fixed again for this change.

Co-authored-by: Phill Wiggins <phill.wiggins@gmail.com>

* Release/1.0.26 - Code formatting, remove lint issues

Co-authored-by: mregandla <3104483+mregandla@users.noreply.github.com>
Co-authored-by: L. Rommy Arbantas <arbantas@gmail.com>
Co-authored-by: James Brinkerhoff <th3brink@gmail.com>
Co-authored-by: Michal Baran <baranmichal25@gmail.com>
Co-authored-by: Maximilian Fischer <45403027+maaeps@users.noreply.github.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants