Skip to content

Objective-C code snippets formatted incorrectly when nested in Tab #12590

@vashworth

Description

@vashworth

Page URL

https://docs.flutter.dev/add-to-app/ios/add-flutter-screen#create-a-flutterengine

Page source

No response

Describe the problem

The code snippet has incorrect #import at the top:

BAD:
#import <flutterpluginregistrant generatedpluginregistrant.h="">

Also incorrect parameters:

BAD:
- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary<uiapplicationlaunchoptionskey, id=""> *)launchOptions {

Also, has a weird end tag

BAD:
</uiapplicationlaunchoptionskey,>
Image

Expected fix

The expected snippet should look like this:

// The following library connects plugins with iOS platform code to this app.
#import <FlutterPluginRegistrant/GeneratedPluginRegistrant.h>

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions {
  self.flutterEngine = [[FlutterEngine alloc] initWithName:@"my flutter engine"];
  // Runs the default Dart entrypoint with a default Flutter route.
  [self.flutterEngine run];
  // Connects plugins with iOS platform code to this app.
  [GeneratedPluginRegistrant registerWithRegistry:self.flutterEngine];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

@end

Additional context

Seems like this happens anytime we have < or > in a code snippet that is nested within a tab

I would like to fix this problem.

  • I will try and fix this problem on docs.flutter.dev.

Metadata

Metadata

Assignees

Labels

from.page-issueReported in a reader-filed concerninfra.structureRelates to the tools that create docs.flutter.devp2-mediumNecessary but not urgent concern. Resolve when possible.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions