Fix default list type for frozen messages (#654)

Co-authored-by: Loren Van Spronsen <lorenvs@google.com>
diff --git a/protobuf/lib/src/protobuf/field_set.dart b/protobuf/lib/src/protobuf/field_set.dart
index 62d5d06..ff36282 100644
--- a/protobuf/lib/src/protobuf/field_set.dart
+++ b/protobuf/lib/src/protobuf/field_set.dart
@@ -244,7 +244,7 @@
 
   List<T> _getDefaultList<T>(FieldInfo<T> fi) {
     assert(fi.isRepeated);
-    if (_isReadOnly) return FrozenPbList._(const []);
+    if (_isReadOnly) return fi.readonlyDefault;
 
     // TODO(skybrian) we could avoid this by generating another
     // method for repeated fields:
diff --git a/protoc_plugin/test/repeated_field_test.dart b/protoc_plugin/test/repeated_field_test.dart
index 2683745..d62ccf4 100644
--- a/protoc_plugin/test/repeated_field_test.dart
+++ b/protoc_plugin/test/repeated_field_test.dart
@@ -32,4 +32,16 @@
             .check,
         isNotNull);
   });
+
+  test('check read-only default list type', () {
+    final msg = TestAllTypes()..freeze();
+    final list = msg.repeatedInt32;
+    expect(
+      list.firstWhere(
+        (_msg) => false,
+        orElse: () => 123,
+      ),
+      123,
+    );
+  });
 }