@@ -368,6 +368,11 @@ abstract class PerAccountStoreBase {
368
368
/// Always equal to `account.realmUrl` and `connection.realmUrl` .
369
369
Uri get realmUrl => connection.realmUrl;
370
370
371
+ /// Resolve [reference] as a URL relative to [realmUrl] .
372
+ ///
373
+ /// This returns null if [reference] fails to parse as a URL.
374
+ Uri ? tryResolveUrl (String reference) => _tryResolveUrl (realmUrl, reference);
375
+
371
376
////////////////////////////////
372
377
// Data attached to the self-account on the realm.
373
378
@@ -381,6 +386,17 @@ abstract class PerAccountStoreBase {
381
386
Account get account => _globalStore.getAccount (accountId)! ;
382
387
}
383
388
389
+ const _tryResolveUrl = tryResolveUrl;
390
+
391
+ /// Like [Uri.resolve] , but on failure return null instead of throwing.
392
+ Uri ? tryResolveUrl (Uri baseUrl, String reference) {
393
+ try {
394
+ return baseUrl.resolve (reference);
395
+ } on FormatException {
396
+ return null ;
397
+ }
398
+ }
399
+
384
400
/// Store for the user's data for a given Zulip account.
385
401
///
386
402
/// This should always have a consistent snapshot of the state on the server,
@@ -522,11 +538,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
522
538
////////////////////////////////
523
539
// Data attached to the realm or the server.
524
540
525
- /// Resolve [reference] as a URL relative to [realmUrl] .
526
- ///
527
- /// This returns null if [reference] fails to parse as a URL.
528
- Uri ? tryResolveUrl (String reference) => _tryResolveUrl (realmUrl, reference);
529
-
530
541
/// Always equal to `connection.zulipFeatureLevel`
531
542
/// and `account.zulipFeatureLevel` .
532
543
int get zulipFeatureLevel => connection.zulipFeatureLevel! ;
@@ -899,17 +910,6 @@ class PerAccountStore extends PerAccountStoreBase with ChangeNotifier, EmojiStor
899
910
String toString () => '${objectRuntimeType (this , 'PerAccountStore' )}#${shortHash (this )}' ;
900
911
}
901
912
902
- const _tryResolveUrl = tryResolveUrl;
903
-
904
- /// Like [Uri.resolve] , but on failure return null instead of throwing.
905
- Uri ? tryResolveUrl (Uri baseUrl, String reference) {
906
- try {
907
- return baseUrl.resolve (reference);
908
- } on FormatException {
909
- return null ;
910
- }
911
- }
912
-
913
913
/// A [GlobalStoreBackend] that uses a live, persistent local database.
914
914
///
915
915
/// Used as part of a [LiveGlobalStore] .
0 commit comments