pub repository
mirror.p-hatan.irfirebase
3.2.0Dart libraries for Firebase
This package is discontinued upstream.
Readme
Dart wrapper library for the new Firebase
This is a Dart wrapper library for the new Firebase. If you are using Dart to write Flutter apps, consider using the FlutterFire plugins instead.
You can find more information on how to use Firebase on the Getting started page.
Don't forget to setup correct rules for your realtime database and/or storage in the Firebase console.
Authentication also has to be enabled in the Firebase console. For more info, see the next section in this document.
Usage
Installation
Install the library from the pub or Github:
dependencies:
firebase: '^3.0.0'
Include Firebase source
You must include the original Firebase JavaScript source into your .html file
to be able to use the library.
<script src="https://www.gstatic.com/firebasejs/3.9.0/firebase.js"></script>
Use it
import 'package:firebase/firebase.dart' as fb;
void main() {
fb.initializeApp(
apiKey: "YourApiKey",
authDomain: "YourAuthDomain",
databaseURL: "YourDatabaseUrl",
storageBucket: "YourStorageBucket");
fb.Database database = fb.database();
fb.DatabaseReference ref = database.ref("messages");
ref.onValue.listen((e) {
fb.DataSnapshot datasnapshot = e.snapshot;
// Do something with datasnapshot
});
}
IO Client
This library also contains an IO client. Create an instance of FirebaseClient and then use the appropriate
method (GET, PUT, POST, DELETE or PATCH).
More info in the official documentation.
The IO client also supports authentication. See the documentation on how to get auth credentials.
import 'package:firebase/firebase_io.dart';
void main() {
var credential = ... // Retrieve auth credential
var fbClient = new FirebaseClient(credential); // FirebaseClient.anonymous() is also available
var path = ... // Full path to your database location with .json appended
// GET
var response = await fbClient.get(path);
// DELETE
await fbClient.delete(path);
...
}
Examples
You can find more examples on realtime database, auth and storage in the example folder.
Dart Dev Summit 2016 demo app
Demo app which uses Google login, realtime database and storage.
Before tests and examples are run
You need to ensure a couple of things before tests and examples in this library are run.
All tests and examples
Create config.json file (see config.json.sample) in lib/src/assets folder
with configuration for your Firebase project.
To run the io tests, you need to provide the service_account.json file. Go to
Settings/Project settings/Service accounts tab in your project's Firebase
console, select the Firebase Admin SDK and click on the
Generate new private key button, which downloads you a file.
Rename the file to service_account.json and put it into the lib/src/assets
folder.
Warning: Use the contents of
lib/src/assetsis only for development and testing this package.
App tests
No special action needed here.
Auth tests and example
Auth tests and some examples need to have Auth providers correctly set.
The following providers need to be enabled in Firebase console,
Auth/Sign-in method section:
- E-mail/password
- Anonymous
Database tests and example
Database tests and example need to have public rules to be able to read and
write to database. Update your rules in Firebase console, Database/Rules
section to:
{
"rules": {
".read": true,
".write": true
}
}
Warning: At the moment, anybody can read and write to your database. You usually don't want to have this in your production apps. You can find more information on how to setup correct database rules in the official Firebase documentation.
Storage tests and example
Storage tests and example need to have public rules to be able to read and
write to storage. Update your rules in Firebase console, Storage/Rules section
to:
service firebase.storage {
match /b/YOUR_STORAGE_BUCKET_URL/o {
match /{allPaths=**} {
allow read, write;
}
}
}
Warning: At the moment, anybody can read and write to your storage. You usually don't want to have this in your production apps. You can find more information on how to setup correct storage rules in the official Firebase documentation.
Bugs
If you find a bug, please file an issue.
Changelog
3.2.0
-
The
FirebaseJsNotLoadedExceptionis thrown when the firebase.js script is not included in the html file. -
Fix to support
dartdevc.
3.1.0
- Updates from the Firebase
3.8.0and3.9.0inauthlibrary:User- Deprecated
linkmethod in favor oflinkWithCredential. - Deprecated
reauthenticatemethod in favor ofreauthenticateWithCredential. - Added new
reauthenticateWithPopupandreauthenticateWithRedirectmethods.
- Deprecated
UserCredential- Added new
operationTypeproperty.
- Added new
AuthCredential- Deprecated
providerproperty in favor ofproviderId.
- Deprecated
- The
app.storage()has now an optional storage bucket parameter.
3.0.2
- Throw
FirebaseClientExceptionif there are request failures infirebase_io.dart. - Fix provider's
addScopeandsetCustomParametersmethods return types. - Support the latest release of
pkg/func.
3.0.1
-
Updated documentation and tests to reference the latest JS release:
3.7.2 -
Improvements to
README.md
3.0.0
- Completely rewritten for Firebase v3.
0.6.6+3
- Support
crypto2.0.0.
0.6.6+2
-
Strong-mode clean.
-
Doc fixes.
0.6.6+1
- Support non-integer values for
priorityin set operations.
0.6.6
-
Support latest version of
pkg/crypto -
Support latest version of
firebase.js- 2.4.2
0.6.5+1
- Fixed
FirebaseClient.postto usePOST.
0.6.5
- Added
FirebaseClient.posttofirebase_io.dart.
0.6.4
- Added
Firebase.ServerValue.TIMESTAMPconstant
0.6.3
- Added
onCompleteargument toFirebase.push.
0.6.2
-
Fix an issue calling
pushwith aMap. -
Fixed the return type of
Firebase.onAuth. Also made the returnedStreamasynchronous.
0.6.1
-
Added
anonymousconstructor toFirebaseClient. -
Added
firebase_io.dartlibrary.createFirebaseJwtTokencan be used for authentication.- The
FirebaseClientclass is a simple wrapper for the FirebaseRESTAPI.
-
Added
encodeKeyanddecodeKeymethods tofirebase.dartandfirebas_io.dart. Convenience methods for dealing with key values with disallowed characters.
0.6.0
-
Removed deprecated
nameproperty onFirebaseandSnapshot. Usekeyinstead`. -
Removed deprecated
limitmethod onFirebase. UselimitToFirstandlimitToLastinstead.
0.5.1
- Updated startAt() and endAt() methods. They don't take a priority anymore and are meant to be used in conjunction with orderBy*
0.5.0
-
Added authWithOAuthToken()
-
Changed return value of auth methods to return a native dart Map object containing all authData. This is a breaking change.
0.4.0
-
Updated for Firebase api v2.2.2
-
Deprecated
namegetter on Firebase and DataSnapshot -
Added
keygetter on Firebase and DataSnapshot, replacingname -
Added changeEmail()
-
Added authAnonymously(), authWithOAuthPopup(), authWithOAuthRedirect()
-
Added getAuth() and onAuth() listener
-
Added orderByChild(), orderByKey(), orderByValue(), orderByPriority()
-
Added equalTo(), limitToFirst(), limitToLast()
-
Deprecated
limiton Query object -
Added
existsgetter to DataSnapshot -
Added several tests
0.3.0
- Add createUser(), removeUser() and authWithPassword() (thanks to wilsynet)
- AuthResponse.auth was changed to type JsObject
0.2.1
- Added new
authWithCustomTokenmethod (thanks to rayk) - Deprecate
auth
0.2.0+1
- Updated README to include latest
firebase.jslink.
0.2.0
-
A number of breaking changes and updates.
-
A number of methods are now properties.
0.1.1+3
-
Fixed up tests.
-
Cleaned up library structure.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add firebasepubspec.yaml
name: firebase
description: Dart libraries for Firebase
version: 3.2.0
authors:
- Jana Moudra <jana.moudra@gmail.com>
- Kevin Moore <kevmoo@google.com>
homepage: https://github.com/firebase/firebase-dart
environment:
sdk: '>=1.18.0 <2.0.0'
dependencies:
browser: '>=0.10.0 <0.11.0'
func: ">=0.1.0 <2.0.0"
http: '^0.11.3'
js: ">=0.6.0 <0.7.0"
dev_dependencies:
googleapis_auth: '^0.2.3+5'
path: '^1.3.9'
test: '>=0.12.17 <0.13.0'
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | 2014-01-02T19:28:17.941390Z | Download | 892751351c2527f5542df0cf91ce769b94fa5ae75615ddead63dae2af9e45228 |
| 0.1.1 | 2014-07-25T18:11:00.581440Z | Download | 65740f8629071e3b99dccfa2ff1b031cb37193162532ea0e57461839c64bf599 |
| 0.1.1+1 | 2014-08-01T18:14:27.132940Z | Download | 61ff1b0c175c4b45f4afdd179854762361c46e3a28e450ee60f10d8588d26e32 |
| 0.1.1+3 | 2014-09-22T19:54:46.411870Z | Download | 0dbd7e89b8feaba47f4dfe35cb7f15cbd7fec9b0ead4a2e11d0d0230b98af9b3 |
| 0.2.0 | 2014-10-21T22:38:47.912550Z | Download | 7c842cd0479d5b226d5734ce1e6262a21713637ac4219a7bf414ffba4361be64 |
| 0.2.0+1 | 2014-10-21T22:40:33.267910Z | Download | d9fca850190117317cdeb08b426da18d733c6432559bfac75b0e877c9b2ad9da |
| 0.2.1 | 2014-12-09T18:10:07.145140Z | Download | 681520a4bf7ef6ea07b2546f95b35694b1b365444dec1bbd8df9278d5c10a99c |
| 0.3.0 | 2015-01-09T01:32:55.809170Z | Download | 58a17d9e28e7382dc3a733189c07cd8d978e2ff5a63067a21fb8abc47b3219a5 |
| 0.4.0 | 2015-03-16T19:41:11.309920Z | Download | 591824ee223574f0ef5ce0504eb45b8778f56f916b55e4821f4302befeb0d4fd |
| 0.5.0 | 2015-03-18T05:14:11.782930Z | Download | 2e12f0b4fbf141b240d768ba93fe56e6bd9100ec7970e64b463e92193bb89c6d |
| 0.5.1 | 2015-04-26T16:37:43.820Z | Download | a56626ca3d4382a24acf7eb530a448393bf028317d9a740888ef3cf67c8b4537 |
| 0.6.0 | 2015-07-01T22:36:18.220Z | Download | e9dd2639b6029cc7f0eb15e2c07e76f8728d5b30a84fab98a8a67e9fc567360f |
| 0.6.1 | 2015-07-13T01:34:46.124Z | Download | 5b56f26d4f487514ed719f63c5b8efef4c137b077af6287f4055c3d00654bba1 |
| 0.6.2 | 2015-07-27T18:48:11.188Z | Download | d824ce67a83d7dba3d1e013f8e60b02c32c62c29cd8695d57be2d8862518b678 |
| 0.6.3 | 2015-08-03T17:17:06.156Z | Download | e847ae75e23156da9dd51fec615d9ebaa5e17a636c9f873c7e6101dc0bf79208 |
| 0.6.4 | 2015-10-10T15:43:46.097Z | Download | 7ad43d04cf95d7b501c1875b4ab1b1ecc79f9062dbbe802375cbfbdabb334937 |
| 0.6.5 | 2015-11-26T01:24:28.264Z | Download | 79d0f69d5f723e2da0162bbfa539c769196c905496633bfd4af792f79f673ae7 |
| 0.6.5+1 | 2016-01-08T00:26:08.357Z | Download | aa3757218c9834dd917207d8219a912ebfb400f3c9f6498bb1f614610f8910c4 |
| 0.6.6 | 2016-04-04T17:38:49.972Z | Download | 5d9e63554f06625311ec78da388604bcb8f83cb5d7f26e7c38b8d1b0790e27dd |
| 0.6.6+1 | 2016-04-13T22:03:24.495Z | Download | 8abeabb28314db981981b7ad23dcc0e6d71126626548c9b0fec6ba092966b9d1 |
| 0.6.6+2 | 2016-06-02T23:47:46.290Z | Download | 6f2b669a83cfdeeba59a10e8a6f34f24ffbad67b0ac03e6a7090f7175014c080 |
| 0.6.6+3 | 2016-06-04T02:40:26.722Z | Download | a414be92049399fe214ef19e773a2ee9ec417976e435f0c1b5e2c9b64b56267a |
| 3.0.0 | 2016-12-14T18:25:55.949Z | Download | 0cf72a75fe01cc08179646aea8569afd712ace87c9f4ff9f11b981c1b9a65d68 |
| 3.0.1 | 2017-03-19T17:21:22.057573Z | Download | e2548384121609fd64d6e41218bff931298c8d208a715c9bf11c9b21ce6094b6 |
| 3.0.2 | 2017-04-17T19:42:14.580847Z | Download | c6728753d8f32183b5cb7756fe3da207e039a698a07d51b9b1031ace2c757c76 |
| 3.1.0 | 2017-04-27T16:59:30.315695Z | Download | f66d2554c6593734b3797364697a2758569a3467fba17598b6936485d75b1cfa |
| 3.2.0 | 2017-06-12T09:42:32.119076Z | Download | 8f5bce0d1d83ef34eb36a1e1c2c1cde69a3b1ea098d356185d4d0c83d0aa4157 |
| 4.0.0 | 2017-07-17T16:56:46.791263Z | Download | 44469a2428bde26a674588478ea7208ba99f4c4abd050414e9fae9216f8df73e |
| 4.1.0 | 2017-08-03T20:59:46.555373Z | Download | 59a51a2e516c68703629b625d6336a50a61abaa83f376477ced1a111bf7a1832 |
| 4.2.0 | 2017-12-09T01:15:57.174927Z | Download | 3cb0f6fec95414551b022557bfb632243b49a9bf3d2e67176c0190c9ff940436 |
| 4.2.0+1 | 2017-12-09T01:22:25.617469Z | Download | 79010d323d111cf0cd987d7621052c5e7ff78e50fc4a8e7b0eef18429c4d9a97 |
| 4.3.0 | 2018-01-05T23:15:43.650685Z | Download | 6c3c58ad98c19c9b44edaa3cc49d6adcef2aff47e2c1343a3731311a8ef8148a |
| 4.3.1 | 2018-01-11T05:13:51.535435Z | Download | b152d793b27155155cb73cf31c7f87adea1644b205d310b7e6970863b67f7095 |
| 4.4.0 | 2018-03-04T23:25:29.840090Z | Download | 99722783f30f6616eda74be4f6348f9256fdf786acd2a8bd3c781b977417a3be |
| 4.5.0 | 2018-06-08T15:59:21.697924Z | Download | f78fb3905151b920490aee030ffe5a21e39eda32826f5f2baac54badcc2f85d7 |
| 4.5.1 | 2018-06-20T22:58:47.362111Z | Download | 9191fe436c2afd717f73a5c82b5a7599a0d0f8e0373e7882eeb48409d1ae357d |
| 5.0.0-beta | 2018-06-30T02:52:14.167777Z | Download | 9f291cf12003ebf19b8299d3fb325ab9762063c5db67d0bf3761696dbc45fbf4 |
| 5.0.0 | 2018-07-13T23:07:20.945532Z | Download | a6b5067f21481bbec773c66e35c9198e0e731f007316552c5ce049d30b8418a7 |
| 5.0.1 | 2018-07-13T23:12:52.555511Z | Download | 68611f8eecb30e37828134b8d940c5d1c7c8445de116c609417f639bb20e4e2c |
| 5.0.2 | 2018-10-07T21:16:54.922173Z | Download | e08bed76b9d8da752dc557118e851bc571bf1c5730162c2a3bd9fd5c82d11e50 |
| 5.0.3 | 2019-03-28T23:03:29.687258Z | Download | eceaa8133e3b654ae1ca807d70c2913725ac3f315722cd9eea88e6a9c36cebd1 |
| 5.0.4-dev | 2019-07-22T17:24:15.408100Z | Download | 490ad2de115f5d681e7617d107dae0c4eaa0c625b0a4c5242891fb4f288722c5 |
| 5.0.4 | 2019-07-22T17:25:19.165516Z | Download | d9d55a86dd7456d1aac576b2bb77a044c3159c6ffa5eeff5e1990b719fe3b002 |
| 6.0.0 | 2019-10-15T21:54:31.175127Z | Download | 3b19097eaa23ddd81cb4b30eec0b71336f1ccdc5b4833dbd1c6350fbdb24c06e |
| 7.0.0 | 2019-11-28T06:17:26.476196Z | Download | 4ffe20036ed4267770ead309b3e393cd37e5742f59dd1cb017e9b17f1a93087b |
| 7.1.0 | 2019-12-05T20:40:28.374435Z | Download | 5569cab9d969fd1cdd69dc70d7e4a8b7cfaa133ba778a54223cd08bba0816c30 |
| 7.2.0 | 2020-01-10T01:10:03.781006Z | Download | d9f65b8050371b176b7f3100033c921f6b42b52f9ea991b66ab4769c23b31e85 |
| 7.2.1 | 2020-01-30T21:42:46.797737Z | Download | c6d17b6e3f68cfe85a3a6f83c697e1745fa78e50f8f73be27b3d8a14364dccc8 |
| 7.3.0 | 2020-04-06T20:02:44.800749Z | Download | 94020b2ffa27394120d98db3abd39f94ec28fdeb5038d97acfe2c5652a60cb35 |
| 7.3.1 | 2020-10-14T00:16:15.813378Z | Download | dabc157190c385e5370c2e4602d12e9eac0d148743ea1e64cd8357deb227e14e |
| 7.3.2 | 2020-10-14T20:12:44.387846Z | Download | d5e77ca08ed8db4daee4b2cf69a5e8bd981043bf895d440e836bf88ebd40c632 |
| 7.3.3 | 2020-12-01T23:28:17.083628Z | Download | 587cc00f86bba331e5b033ea85e4cc787d8874e250141de8307c876547236519 |
| 8.0.0 | 2020-12-30T01:55:46.384912Z | Download | 5d3039e169aeceb85103526c585125266a03c59be4c0d321c47a1cf7d44cf853 |
| 9.0.0 | 2021-02-23T01:37:22.448017Z | Download | c0666d4c7aefa5940ff5baa294e5b394690151ad3dcc73511856f086aec1ab97 |
| 9.0.1 | 2021-03-19T19:41:29.247975Z | Download | 935f6035eae3d7220c58ebd08c2abaea95d405109805a70f688d0d3119fa4291 |
| 9.0.2 | 2021-09-13T20:54:35.497366Z | Download | f5dd310bab11692446115ad83e7ffb27a2e6b7469cd6e0f7cb77e020c4c9429f |
| 9.0.3 | 2022-05-06T20:17:36.819435Z | Download | cbff777369d19bd0535ccca0005518172953394246620ff8c1021072299d452d |
Dependencies
browser "\u003e=0.10.0 \u003c0.11.0"
func "\u003e=0.1.0 \u003c2.0.0"
http "^0.11.3"
js "\u003e=0.6.0 \u003c0.7.0"