easy_storybook 1.0.7 copy "easy_storybook: ^1.0.7" to clipboard
easy_storybook: ^1.0.7 copied to clipboard

EasyStorybook Project

Easy storybook

Easy setup #

  const apiEndpoint = 'https://tech.fighttech.vn';
  const apiKey = 'prjectdname@api@r0';
  const projectId = 'prjectdname';
  const version = '1';

  Future<void> main() async {
    WidgetsFlutterBinding.ensureInitialized();

    // Local database
    final sharedPreferences = await SharedPreferences.getInstance();

    // Remote datasource
    final mockApiResponse = await AppMockApi.shared.loadApiResponseJson();
    final dio = Dio(BaseOptions(baseUrl: MockAdapter.mockBase))
      ..httpClientAdapter = MockAdapter(mockApiResponse);

    injector.registerSingleton<Dio>(dio);
    injector.registerSingleton<SharedPreferences>(sharedPreferences);

    runApp(
      MaterialAppStorybook(
      sharedPreferences: sharedPreferences,
      storybookScreen: const HotreloadWidgetbook(),
      verifyPreviewCode: VerifyPreviewCode(
        apiEndpoint: apiEndpoint,
        apiKey: apiKey,
        projectId: projectId,
        version: version,
      ),
    )
    );
  }