Issue 1:
firebase_database: 1.0.2

Steps to Reproduce

Run a simple Flutter app:

https://gist.github.com/dotdoom/5180eb27084afb3b71db44f2201c6877

Most important part is (for history purposes):

(await FirebaseDatabase.instance
.reference()
.child(subpath)
.orderByChild('year')
.limitToFirst(3)
.onValue
.first)
.snapshot
.value
.values
.forEach((v) => debugPrint(v['year'].toString()));

The output is indeed the first 3 entries of a sorted list, but the entries themselves are not sorted:

I/flutter ( 6096): Sorted years:
I/flutter ( 6096): 1856
I/flutter ( 6096): 1867
I/flutter ( 6096): 1564

limitToFirst does not affect the order and is only to demonstrate that Firebase server gets the correct request.

I suspect there might be some issue when transferring data between Java and Dart where the map ordering is lost. Unfortunately it's buried too deep for me to find quickly, so I hope someone with more experience in the MethodChannel mechanism can help me out. The type of the map in Flutter app is _InternalLinkedHashMap which IIUC is supposed to be ordered.

Logs

[✓] Flutter (Channel beta, v0.5.1, on Linux, locale en_US.UTF-8)
• Flutter version 0.5.1 at /home/artem/pkg/flutter
• Framework revision c7ea3ca377 (7 weeks ago), 2018-05-29 21:07:33 +0200
• Engine revision 1ed25ca7b7
• Dart version 2.0.0-dev.58.0.flutter-f981f09760

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.0)
• Android SDK at /home/artem/Android/Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.0
• Java binary at: /home/artem/pkg/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
• All Android licenses accepted.

[✓] Android Studio (version 3.1)
• Android Studio at /home/artem/pkg/android-studio
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)

[!] VS Code (version 1.25.1)
• VS Code at /usr/share/code
• Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected devices (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)

! Doctor found issues in 1 category.

Issue 2:
I believe that the cause is that the bar's state allocates animation controllers for each item when the state is first constructed, but it doesn't create new controllers when the state updates with more items.

Steps to Reproduce

Create a nav bar with 3 items.

Increase the number of items to 4.

RangeError(index): invalid value: not in range 0..2, inclusive: 3.

## Logs
I/flutter (27323): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (27323): The following RangeError was thrown building BottomNavigationBar(dirty, state:
I/flutter (27323): _BottomNavigationBarState#68e58(tickers: tracking 3 tickers)):
I/flutter (27323): RangeError (index): Invalid value: Not in range 0..2, inclusive: 3
I/flutter (27323):
I/flutter (27323): When the exception was thrown, this was the stack:
I/flutter (27323): #0 List.[] (dart:core-patch/dart:core/growable_array.dart:141)
I/flutter (27323): #1 _BottomNavigationBarState._createTiles (package:flutter/src/material/bottom_navigation_bar.dart:411:26)
I/flutter (27323): #2 _BottomNavigationBarState.build (package:flutter/src/material/bottom_navigation_bar.dart:477:45)
I/flutter (27323): #3 StatefulElement.build (package:flutter/src/widgets/framework.dart:3690:27)
I/flutter (27323): #4 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3602:15)
I/flutter (27323): #5 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #6 StatefulElement.update (package:flutter/src/widgets/framework.dart:3737:5)
I/flutter (27323): #7 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #8 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #9 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #10 ProxyElement.update (package:flutter/src/widgets/framework.dart:3847:5)
I/flutter (27323): #11 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #12 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #13 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #14 ProxyElement.update (package:flutter/src/widgets/framework.dart:3847:5)
I/flutter (27323): #15 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #16 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:4317:32)
I/flutter (27323): #17 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4703:17)
I/flutter (27323): #18 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #19 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #20 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #21 ProxyElement.update (package:flutter/src/widgets/framework.dart:3847:5)
I/flutter (27323): #22 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #23 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #24 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #25 StatefulElement.update (package:flutter/src/widgets/framework.dart:3737:5)
I/flutter (27323): #26 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #27 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4595:14)
I/flutter (27323): #28 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #30 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #31 StatelessElement.update (package:flutter/src/widgets/framework.dart:3662:5)
I/flutter (27323): #32 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #33 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:4595:14)
I/flutter (27323): #34 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #35 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #36 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #37 StatefulElement.update (package:flutter/src/widgets/framework.dart:3737:5)
I/flutter (27323): #38 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #39 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #40 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #41 StatefulElement.update (package:flutter/src/widgets/framework.dart:3737:5)
I/flutter (27323): #42 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #43 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #44 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #45 ProxyElement.update (package:flutter/src/widgets/framework.dart:3847:5)
I/flutter (27323): #46 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #47 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #48 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #49 ProxyElement.update (package:flutter/src/widgets/framework.dart:3847:5)
I/flutter (27323): #50 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #51 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #52 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #53 StatefulElement.update (package:flutter/src/widgets/framework.dart:3737:5)
I/flutter (27323): #54 Element.updateChild (package:flutter/src/widgets/framework.dart:2667:15)
I/flutter (27323): #55 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3613:16)
I/flutter (27323): #56 Element.rebuild (package:flutter/src/widgets/framework.dart:3463:5)
I/flutter (27323): #57 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2210:33)
I/flutter (27323): #58 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:621:20)
I/flutter (27323): #59 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter (27323): #60 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (27323): #61 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (27323): #62 BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter (27323): #63 _invoke (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:120)
I/flutter (27323): #64 _drawFrame (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:109)
I/flutter (27323): ════════════════════════════════════════════════════════════════════════════════════════════════════

Doctor

Version of Flutter is the current g3 version.