Lucian Xeno
Lucian Xeno

Reputation: 123

Dart, creating cookies and reading them

I want a way of saving progress/values on my web page so when some one exits and comes back onto the web pages they wont lose anything. Say money for instance. I am creating a game and they earn money but if they exit and come back they will be reset back to 0.

I thought maybe cookies would be a good idea to save the values of variables? Also when they return to the web page it would need to detect the cookies and receive the values and set the variables accordantly.

how would I go about doing this, or is there an easier/better way?

Upvotes: 3

Views: 1189

Answers (2)

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657248

polymer_elements for Dart offers this functionality too

  • polymer_cookie

or

  • polymer_localstorage

Upvotes: 0

Greg Lowe
Greg Lowe

Reputation: 16261

Cookies can't hold much information. Sounds like you want to store more.

First have a look at local storage - sample here.

Or you can consider using lawndart which is an api built on top of indexeddb and websql (for Safari). Here is a tutorial about indexed db.

Upvotes: 3

Related Questions