@@ -9,7 +9,7 @@ @interface NSError (FlutterError)
99@implementation NSError (FlutterError)
1010- (FlutterError *)flutterError {
1111 return [FlutterError
12- errorWithCode: [NSString stringWithFormat: @" Error %d " , self .code]
12+ errorWithCode: [NSString stringWithFormat: @" Error %ld " , self .code]
1313 message: self .domain
1414 details: self .localizedDescription];
1515}
@@ -24,6 +24,13 @@ + (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar> *)registrar {
2424 binaryMessenger: [registrar messenger ]];
2525 FirebaseDatabasePlugin *instance = [[FirebaseDatabasePlugin alloc ] init ];
2626 [registrar addMethodCallDelegate: instance channel: channel];
27+ // TODO(jackson): stub code that should be replaced with dynamic registration.
28+ [[[FIRDatabase database ].reference queryLimitedToLast: 10 ]
29+ observeEventType: FIRDataEventTypeChildAdded
30+ withBlock: ^(FIRDataSnapshot *_Nonnull snapshot) {
31+ [channel invokeMethod: @" DatabaseReference#childAdded"
32+ arguments: @[ snapshot.key, snapshot.value ]];
33+ }];
2734}
2835
2936- (instancetype )init {
@@ -32,12 +39,6 @@ - (instancetype)init {
3239 if (![FIRApp defaultApp ]) {
3340 [FIRApp configure ];
3441 }
35- [[[FIRDatabase database ].reference queryLimitedToLast: 10 ]
36- observeEventType: FIRDataEventTypeChildAdded
37- withBlock: ^(FIRDataSnapshot *_Nonnull snapshot) {
38- [channel invokeMethod: @" DatabaseReference#childAdded"
39- arguments: @[ snapshot.key, snapshot.value ]];
40- }];
4142 }
4243 return self;
4344}
0 commit comments