"Fossies" - the Fresh Open Source Software Archive 
Member "flutter-3.7.1/dev/docs/dashing_postprocess.dart" (1 Feb 2023, 1332 Bytes) of package /linux/misc/flutter-3.7.1.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Dart source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 // Copyright 2014 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 import 'dart:io';
6
7 /// This changes the DocSetPlatformFamily key to be "dartlang" instead of the
8 /// name of the package (usually "flutter").
9 ///
10 /// This is so that the IntelliJ plugin for Dash will be able to go directly to
11 /// the docs for a symbol from a keystroke. Without this, flutter isn't part
12 /// of the list of package names it searches. After this, it finds the flutter
13 /// docs because they're declared here to be part of the "dartlang" family of
14 /// docs.
15 ///
16 /// Dashing doesn't have a way to configure this, so we modify the Info.plist
17 /// directly to make the change.
18 void main(List<String> args) {
19 final File infoPlist = File('flutter.docset/Contents/Info.plist');
20 String contents = infoPlist.readAsStringSync();
21
22 // Since I didn't want to add the XML package as a dependency just for this,
23 // I just used a regular expression to make this simple change.
24 final RegExp findRe = RegExp(r'(\s*<key>DocSetPlatformFamily</key>\s*<string>)[^<]+(</string>)', multiLine: true);
25 contents = contents.replaceAllMapped(findRe, (Match match) {
26 return '${match.group(1)}dartlang${match.group(2)}';
27 });
28 infoPlist.writeAsStringSync(contents);
29 }