Skip to content

Commit

Permalink
Making restInstances readOnly!
Browse files Browse the repository at this point in the history
  • Loading branch information
tiholic committed Sep 17, 2020
1 parent c9b9c89 commit 25bda81
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/src/impl/rest/rest.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:collection';

import 'package:ably_flutter_plugin/src/impl/message.dart';

Expand All @@ -7,7 +8,9 @@ import '../../spec/spec.dart' as spec;
import '../platform_object.dart';
import 'channels.dart';

Map<int, Rest> restInstances = {};
Map<int, Rest> _restInstances = {};
Map<int, Rest> _restInstancesUnmodifiableView;
Map<int, Rest> get restInstances => _restInstancesUnmodifiableView ??= UnmodifiableMapView(_restInstances);

class Rest extends PlatformObject implements spec.RestInterface<RestPlatformChannels> {

Expand All @@ -27,7 +30,7 @@ class Rest extends PlatformObject implements spec.RestInterface<RestPlatformChan
PlatformMethod.createRestWithOptions,
AblyMessage(options)
);
restInstances[handle] = this;
_restInstances[handle] = this;
return handle;
}

Expand Down

0 comments on commit 25bda81

Please sign in to comment.